mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
47010ccffa
- Major rewrite of ddl_log.cc and ddl_log.h - ddl_log.cc described in the beginning how the recovery works. - ddl_log.log has unique signature and is dynamic. It's easy to add more information to the header and other ddl blocks while still being able to execute old ddl entries. - IO_SIZE for ddl blocks is now dynamic. Can be changed without affecting recovery of old logs. - Code is more modular and is now usable outside of partition handling. - Renamed log file to dll_recovery.log and added option --log-ddl-recovery to allow one to specify the path & filename. - Added ddl_log_entry_phase[], number of phases for each DDL action, which allowed me to greatly simply set_global_from_ddl_log_entry() - Changed how strings are stored in log entries, which allows us to store much more information in a log entry. - ddl log is now always created at start and deleted on normal shutdown. This simplices things notable. - Added probes debug_crash_here() and debug_simulate_error() to simply crash testing and allow crash after a given number of times a probe is executed. See comments in debug_sync.cc and rename_table.test for how this can be used. - Reverting failed table and view renames is done trough the ddl log. This ensures that the ddl log is tested also outside of recovery. - Added helper function 'handler::needs_lower_case_filenames()' - Extend binary log with Q_XID events. ddl log handling is using this to check if a ddl log entry was logged to the binary log (if yes, it will be deleted from the log during ddl_log_close_binlogged_events() - If a DDL entry fails 3 time, disable it. This is to ensure that if we have a crash in ddl recovery code the server will not get stuck in a forever crash-restart-crash loop. mysqltest.cc changes: - --die will now replace $variables with their values - $error will contain the error of the last failed statement storage engine changes: - maria_rename() was changed to be more robust against crashes during rename.
52 lines
1.3 KiB
Text
52 lines
1.3 KiB
Text
create database test2;
|
|
#
|
|
# Testing rename error in different places
|
|
#
|
|
create table t1 (a int);
|
|
create table T2 (b int);
|
|
create table t3 (c int);
|
|
create table T4 (d int);
|
|
insert into t1 values(1);
|
|
insert into T2 values(2);
|
|
insert into t3 values(3);
|
|
insert into T4 values(4);
|
|
create temporary table tmp1 (a int);
|
|
create temporary table tmp2 (b int);
|
|
create temporary table tmp3 (c int);
|
|
create temporary table tmp4 (d int);
|
|
insert into tmp1 values(11);
|
|
insert into tmp2 values(22);
|
|
insert into tmp3 values(33);
|
|
insert into tmp4 values(44);
|
|
rename table t3 to T4, t1 to t5, T2 to t1, t5 to T2;
|
|
ERROR 42S01: Table 'T4' already exists
|
|
rename table t1 to t5, t3 to T4, T2 to t1, t5 to T2;
|
|
ERROR 42S01: Table 'T4' already exists
|
|
rename table t1 to t5, T2 to t1, t3 to T4, t5 to T2;
|
|
ERROR 42S01: Table 'T4' already exists
|
|
rename table t1 to t5, T2 to t1, t5 to T2, t3 to T4;
|
|
ERROR 42S01: Table 'T4' already exists
|
|
# Try failed rename using two databases
|
|
rename table test.t1 to test2.t5, test.T2 to test.t1, t5 to test.T2;
|
|
ERROR 42S02: Table 'test.t5' doesn't exist
|
|
select t1.a+T2.b+t3.c+T4.d from t1,T2,t3,T4;
|
|
t1.a+T2.b+t3.c+T4.d
|
|
10
|
|
select * from t5;
|
|
ERROR 42S02: Table 'test.t5' doesn't exist
|
|
T2.MYD
|
|
T2.MYI
|
|
T2.frm
|
|
T4.MYD
|
|
T4.MYI
|
|
T4.frm
|
|
db.opt
|
|
t1.MYD
|
|
t1.MYI
|
|
t1.frm
|
|
t3.MYD
|
|
t3.MYI
|
|
t3.frm
|
|
# Cleanup
|
|
drop table t1,T2,t3,T4;
|
|
drop database test2;
|