SET GLOBAL innodb_flush_log_at_trx_commit= 1; RESET MASTER; CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb; *** Test that FLUSH LOGS waits if a transaction ordered commit is in progress. connect con1,localhost,root,,; SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL con1_ready WAIT_FOR con1_go"; INSERT INTO t1 VALUES (1, REPEAT("x", 1)); connection default; SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; SET DEBUG_SYNC= "rotate_after_rotate SIGNAL con_flush_ready WAIT_FOR default_go"; FLUSH LOGS; connect con2,localhost,root,,; Trx_1 is not yet committed: SELECT count(*) as 'ZERO' from t1; ZERO 0 Wait for Trx_2 has rotated binlog: SET DEBUG_SYNC= "now WAIT_FOR con_flush_ready"; SET DEBUG_SYNC= "now SIGNAL default_go"; # restart connection default; Must be tree logs in the list: show binary logs; Log_name File_size master-bin.000001 # master-bin.000002 # master-bin.000003 # include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION master-bin.000001 # Gtid_list # # [] master-bin.000001 # Binlog_checkpoint # # master-bin.000001 master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1, REPEAT("x", 1)) master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Rotate # # master-bin.000002;pos=POS Only one Binlog checkpoint must exist and point to master-bin.000001 include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION master-bin.000002 # Gtid_list # # [#-#-#] master-bin.000002 # Binlog_checkpoint # # master-bin.000001 SELECT count(*) as 'ONE' from t1; ONE 1 connection default; DROP TABLE t1; SET debug_sync = 'reset';