mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +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.
147 lines
7 KiB
Text
147 lines
7 KiB
Text
RESET MASTER;
|
|
"engine: myisam crash point: ddl_log_rename_before_binlog position: 1"
|
|
"engine: myisam crash point: ddl_log_rename_after_binlog position: 1"
|
|
"engine: aria crash point: ddl_log_rename_before_binlog position: 1"
|
|
"engine: aria crash point: ddl_log_rename_after_binlog position: 1"
|
|
include/show_binlog_events.inc
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000002 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000002 # Query # # use `test`; insert into t1 values(null)
|
|
master-bin.000002 # Query # # COMMIT
|
|
master-bin.000002 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000002 # Query # # use `test`; insert into t2 values(null)
|
|
master-bin.000002 # Query # # COMMIT
|
|
master-bin.000002 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000002 # Query # # use `test`; insert into t3 values(null)
|
|
master-bin.000002 # Query # # COMMIT
|
|
master-bin.000002 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000002 # Query # # use `test`; insert into t4 values(null)
|
|
master-bin.000002 # Query # # COMMIT
|
|
master-bin.000002 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000002 # Query # # use `test`; delete from t1 where a > 100
|
|
master-bin.000002 # Query # # COMMIT
|
|
master-bin.000002 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000002 # Query # # use `test`; delete from t2 where b > 100
|
|
master-bin.000002 # Query # # COMMIT
|
|
master-bin.000002 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000002 # Query # # use `test`; delete from t3 where c > 100
|
|
master-bin.000002 # Query # # COMMIT
|
|
master-bin.000002 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000002 # Query # # use `test`; delete from t4 where d > 100
|
|
master-bin.000002 # Query # # COMMIT
|
|
master-bin.000002 # Gtid # # GTID #-#-#
|
|
master-bin.000002 # Query # # use `test`; flush tables
|
|
master-bin.000002 # Gtid # # GTID #-#-#
|
|
master-bin.000002 # Query # # use `test`; rename table t1 to t5, t2 to t1, t5 to t2, t4 to t5, t3 to t4
|
|
include/show_binlog_events.inc
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000003 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000003 # Query # # use `test`; insert into t1 values(null)
|
|
master-bin.000003 # Query # # COMMIT
|
|
master-bin.000003 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000003 # Query # # use `test`; insert into t2 values(null)
|
|
master-bin.000003 # Query # # COMMIT
|
|
master-bin.000003 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000003 # Query # # use `test`; insert into t5 values(null)
|
|
master-bin.000003 # Query # # COMMIT
|
|
master-bin.000003 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000003 # Query # # use `test`; insert into t4 values(null)
|
|
master-bin.000003 # Query # # COMMIT
|
|
master-bin.000003 # Gtid # # GTID #-#-#
|
|
master-bin.000003 # Query # # use `test`; DROP TABLE `t1`,`t2`,`t4`,`t5` /* generated by server */
|
|
master-bin.000003 # Gtid # # GTID #-#-#
|
|
master-bin.000003 # Query # # use `test`; create table t1 (a int not null) transactional=1
|
|
master-bin.000003 # Gtid # # GTID #-#-#
|
|
master-bin.000003 # Query # # use `test`; create table t2 (b int not null) transactional=1
|
|
master-bin.000003 # Gtid # # GTID #-#-#
|
|
master-bin.000003 # Query # # use `test`; create table t3 (c int not null) transactional=1
|
|
master-bin.000003 # Gtid # # GTID #-#-#
|
|
master-bin.000003 # Query # # use `test`; create table t4 (d int not null) transactional=1
|
|
master-bin.000003 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000003 # Query # # use `test`; insert into t1 values(1)
|
|
master-bin.000003 # Query # # COMMIT
|
|
master-bin.000003 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000003 # Query # # use `test`; insert into t2 values(2)
|
|
master-bin.000003 # Query # # COMMIT
|
|
master-bin.000003 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000003 # Query # # use `test`; insert into t3 values(3)
|
|
master-bin.000003 # Query # # COMMIT
|
|
master-bin.000003 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000003 # Query # # use `test`; insert into t4 values(4)
|
|
master-bin.000003 # Query # # COMMIT
|
|
master-bin.000003 # Gtid # # GTID #-#-#
|
|
master-bin.000003 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` trigger t1_trg before insert on t1 for each row
|
|
begin
|
|
if isnull(new.a) then
|
|
set new.a:= 1000;
|
|
end if;
|
|
end
|
|
master-bin.000003 # Gtid # # GTID #-#-#
|
|
master-bin.000003 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` trigger t2_trg before insert on t2 for each row
|
|
begin
|
|
if isnull(new.b) then
|
|
set new.b:= 2000;
|
|
end if;
|
|
end
|
|
master-bin.000003 # Gtid # # GTID #-#-#
|
|
master-bin.000003 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` trigger t3_trg before insert on t3 for each row
|
|
begin
|
|
if isnull(new.c) then
|
|
set new.c:= 4000;
|
|
end if;
|
|
end
|
|
master-bin.000003 # Gtid # # GTID #-#-#
|
|
master-bin.000003 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` trigger t4_trg before insert on t4 for each row
|
|
begin
|
|
if isnull(new.d) then
|
|
set new.d:= 8000;
|
|
end if;
|
|
end
|
|
master-bin.000003 # Gtid # # GTID #-#-#
|
|
master-bin.000003 # Query # # use `test`; flush tables
|
|
include/show_binlog_events.inc
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000004 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000004 # Query # # use `test`; insert into t1 values(null)
|
|
master-bin.000004 # Query # # COMMIT
|
|
master-bin.000004 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000004 # Query # # use `test`; insert into t2 values(null)
|
|
master-bin.000004 # Query # # COMMIT
|
|
master-bin.000004 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000004 # Query # # use `test`; insert into t3 values(null)
|
|
master-bin.000004 # Query # # COMMIT
|
|
master-bin.000004 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000004 # Query # # use `test`; insert into t4 values(null)
|
|
master-bin.000004 # Query # # COMMIT
|
|
master-bin.000004 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000004 # Query # # use `test`; delete from t1 where a > 100
|
|
master-bin.000004 # Query # # COMMIT
|
|
master-bin.000004 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000004 # Query # # use `test`; delete from t2 where b > 100
|
|
master-bin.000004 # Query # # COMMIT
|
|
master-bin.000004 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000004 # Query # # use `test`; delete from t3 where c > 100
|
|
master-bin.000004 # Query # # COMMIT
|
|
master-bin.000004 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000004 # Query # # use `test`; delete from t4 where d > 100
|
|
master-bin.000004 # Query # # COMMIT
|
|
master-bin.000004 # Gtid # # GTID #-#-#
|
|
master-bin.000004 # Query # # use `test`; flush tables
|
|
master-bin.000004 # Gtid # # GTID #-#-#
|
|
master-bin.000004 # Query # # use `test`; rename table t1 to t5, t2 to t1, t5 to t2, t4 to t5, t3 to t4
|
|
include/show_binlog_events.inc
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000005 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000005 # Query # # use `test`; insert into t1 values(null)
|
|
master-bin.000005 # Query # # COMMIT
|
|
master-bin.000005 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000005 # Query # # use `test`; insert into t2 values(null)
|
|
master-bin.000005 # Query # # COMMIT
|
|
master-bin.000005 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000005 # Query # # use `test`; insert into t5 values(null)
|
|
master-bin.000005 # Query # # COMMIT
|
|
master-bin.000005 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000005 # Query # # use `test`; insert into t4 values(null)
|
|
master-bin.000005 # Query # # COMMIT
|
|
master-bin.000005 # Gtid # # GTID #-#-#
|
|
master-bin.000005 # Query # # use `test`; DROP TABLE `t1`,`t2`,`t4`,`t5` /* generated by server */
|