show variables like "recovery_apply_binlog"; Variable_name Value recovery_apply_binlog ON # # DDL crash and recovery # set debug = 'd, crash_commit_before_log'; create table t(id int); ERROR HY000: Lost connection to MySQL server during query show tables; Tables_in_test set debug = 'd, crash_before_large_trx_commit_early'; create table t(id int); ERROR HY000: Lost connection to MySQL server during query show tables; Tables_in_test t # # Normal DML (1000) crash and recovery # set debug = 'd, crash_commit_before_log'; insert into t values (1000); ERROR HY000: Lost connection to MySQL server during query set debug = 'd, crash_before_flush_binlog'; insert into t values (1001); ERROR HY000: Lost connection to MySQL server during query set debug = 'd, crash_before_large_trx_commit_early'; insert into t values (1002); ERROR HY000: Lost connection to MySQL server during query select * from t; id 1002 # # Xa Prepare crash and Rollback after recovery(2000) # xa begin '2001'; insert into t values (2001); xa end '2001'; set debug = 'd, crash_commit_before_log'; xa prepare '2001'; ERROR HY000: Lost connection to MySQL server during query xa recover; formatID gtrid_length bqual_length data xa begin '2002'; insert into t values (2002); xa end '2002'; set debug = 'd, crash_before_large_trx_commit_early'; xa prepare '2002'; ERROR HY000: Lost connection to MySQL server during query xa recover; formatID gtrid_length bqual_length data 1 4 0 2002 xa rollback '2002'; select * from t; id 1002 # # Xa Prepare crash and Commit after recovery(2000) # xa begin '3001'; insert into t values (3001); xa end '3001'; set debug = 'd, crash_commit_before_log'; xa prepare '3001'; ERROR HY000: Lost connection to MySQL server during query xa recover; formatID gtrid_length bqual_length data xa begin '3002'; insert into t values (3002); xa end '3002'; set debug = 'd, crash_before_large_trx_commit_early'; xa prepare '3002'; ERROR HY000: Lost connection to MySQL server during query xa recover; formatID gtrid_length bqual_length data 1 4 0 3002 xa commit '3002'; select * from t; id 1002 3002 # # Xa Commit crash and recovery (4000) # xa begin '4001'; insert into t values (4001); xa end '4001'; xa prepare '4001'; set debug = 'd, crash_commit_before_log'; xa commit '4001'; ERROR HY000: Lost connection to MySQL server during query xa recover; formatID gtrid_length bqual_length data 1 4 0 4001 set debug = 'd, crash_before_large_trx_commit_early'; xa commit '4001'; ERROR HY000: Lost connection to MySQL server during query xa recover; formatID gtrid_length bqual_length data select * from t; id 1002 3002 4001 # # Xa Rollback crash and recovery (5000) # xa begin '5001'; insert into t values (5001); xa end '5001'; xa prepare '5001'; set debug = 'd, crash_commit_before_log'; xa rollback '5001'; ERROR HY000: Lost connection to MySQL server during query xa recover; formatID gtrid_length bqual_length data 1 4 0 5001 set debug = 'd, crash_before_large_trx_commit_early'; xa rollback '5001'; ERROR HY000: Lost connection to MySQL server during query xa recover; formatID gtrid_length bqual_length data select * from t; id 1002 3002 4001 # # Crash happened on XA COMMIT ONE PHASE (5500) # xa begin '5501'; insert into t values (5501); xa end '5501'; set debug = 'd, crash_commit_before_log'; XA COMMIT "5501" ONE PHASE; ERROR HY000: Lost connection to MySQL server during query xa begin '5502'; insert into t values (5502); xa end '5502'; set debug = 'd, crash_before_large_trx_commit_early'; XA COMMIT "5502" ONE PHASE; ERROR HY000: Lost connection to MySQL server during query select * from t; id 1002 3002 4001 5502 # # Xa with binlog And DDL Crash (6000) # create table t1(id int); create table t2(id int); flush logs; xa begin '6001'; insert into t1 values (6001); xa end '6001'; SET DEBUG_SYNC= 'sync_before_commit_stage_in_order_commit WAIT_FOR no_signal'; xa prepare '6001'; create table t3(id int); xa begin '6002'; insert into t2 values (6002); xa end '6002'; SET DEBUG_SYNC= 'sync_before_commit_stage_in_order_commit WAIT_FOR no_signal'; xa prepare '6002'; set debug = 'd, crash_before_large_trx_commit_early'; drop table t3; ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query xa recover; formatID gtrid_length bqual_length data 1 4 0 6002 1 4 0 6001 SET DEBUG_SYNC= 'sync_before_commit_stage_in_order_commit WAIT_FOR no_signal'; xa commit '6001'; SET DEBUG_SYNC= 'sync_before_commit_stage_in_order_commit WAIT_FOR no_signal'; xa commit '6002'; create table t3(id int); set debug = 'd, crash_before_large_trx_commit_early'; drop table t3; ERROR HY000: Lost connection to MySQL server during query show tables; Tables_in_test t t1 t2 # # Xa And DML Crash (7000) # xa begin '7001'; insert into t1 values (7001); xa end '7001'; SET DEBUG_SYNC= 'sync_before_commit_stage_in_order_commit WAIT_FOR no_signal'; xa prepare '7001'; xa begin '7002'; insert into t2 values (7002); xa end '7002'; SET DEBUG_SYNC= 'sync_before_commit_stage_in_order_commit WAIT_FOR no_signal'; xa prepare '7002'; insert into t1 values (7003); insert into t2 values (7003); set debug = 'd, crash_commit_before_log'; insert into t2 values (7004); ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query xa recover; formatID gtrid_length bqual_length data 1 4 0 7002 1 4 0 7001 SET DEBUG_SYNC= 'sync_before_commit_stage_in_order_commit WAIT_FOR no_signal'; xa commit '7001'; SET DEBUG_SYNC= 'sync_before_commit_stage_in_order_commit WAIT_FOR no_signal'; xa commit '7002'; insert into t1 values (7005); insert into t2 values (7005); set debug = 'd, crash_commit_before_log'; insert into t2 values (7006); ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query xa recover; formatID gtrid_length bqual_length data select * from t1; id 6001 7003 7001 7005 select * from t2; id 6002 7003 7002 7005 # # Follower apply xa prapare Crash (8000) # set global debug = 'd, crash_after_update_pos_before_apply'; stop xpaxos_replication; start xpaxos_replication; xa begin '8001'; insert into t1 values (8001); xa end '8001'; xa prepare '8001'; xa recover; ERROR HY000: Lost connection to MySQL server during query xa recover; formatID gtrid_length bqual_length data 1 4 0 8001 xa commit '8001'; set global debug = 'd, crash_after_do_commit_for_xa_prepare_in_mts'; stop xpaxos_replication; start xpaxos_replication; xa begin '8002'; insert into t1 values (8002); xa end '8002'; xa prepare '8002'; xa recover; ERROR HY000: Lost connection to MySQL server during query xa recover; formatID gtrid_length bqual_length data 1 4 0 8002 xa commit '8002'; delete from t1; # # Follower apply xa commit Crash (9000) # xa begin '9001'; insert into t1 values (9001); xa end '9001'; xa prepare '9001'; set global debug = 'd, crash_on_external_xa_commit'; stop xpaxos_replication; start xpaxos_replication; xa commit '9001'; select * from t1; ERROR HY000: Lost connection to MySQL server during query select * from t1; id 9001 drop table t, t1, t2;