| 1 |
SET GLOBAL innodb_flush_log_at_trx_commit= 1; |
| 2 |
RESET MASTER; |
| 3 |
CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb; |
| 4 |
*** Test that FLUSH LOGS waits if a transaction ordered commit is in progress. |
| 5 |
connect con1,localhost,root,,; |
| 6 |
SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL con1_ready WAIT_FOR con1_go"; |
| 7 |
INSERT INTO t1 VALUES (1, REPEAT("x", 1)); |
| 8 |
connection default; |
| 9 |
SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; |
| 10 |
SET DEBUG_SYNC= "rotate_after_rotate SIGNAL con_flush_ready WAIT_FOR default_go"; |
| 11 |
FLUSH LOGS; |
| 12 |
connect con2,localhost,root,,; |
| 13 |
Trx_1 is not yet committed: |
| 14 |
SELECT count(*) as 'ZERO' from t1; |
| 15 |
ZERO |
| 16 |
0 |
| 17 |
Wait for Trx_2 has rotated binlog: |
| 18 |
SET DEBUG_SYNC= "now WAIT_FOR con_flush_ready"; |
| 19 |
SET DEBUG_SYNC= "now SIGNAL default_go"; |
| 20 |
# restart |
| 21 |
connection default; |
| 22 |
Must be tree logs in the list: |
| 23 |
show binary logs; |
| 24 |
Log_name File_size |
| 25 |
master-bin.000001 # |
| 26 |
master-bin.000002 # |
| 27 |
master-bin.000003 # |
| 28 |
include/show_binlog_events.inc |
| 29 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 30 |
master-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION |
| 31 |
master-bin.000001 # Gtid_list # # [] |
| 32 |
master-bin.000001 # Binlog_checkpoint # # master-bin.000001 |
| 33 |
master-bin.000001 # Gtid # # GTID #-#-# |
| 34 |
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb |
| 35 |
master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 36 |
master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1, REPEAT("x", 1)) |
| 37 |
master-bin.000001 # Table_map # # table_id: # (test.t1) |
| 38 |
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F |
| 39 |
master-bin.000001 # Xid # # COMMIT /* XID */ |
| 40 |
master-bin.000001 # Rotate # # master-bin.000002;pos=POS |
| 41 |
Only one Binlog checkpoint must exist and point to master-bin.000001 |
| 42 |
include/show_binlog_events.inc |
| 43 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 44 |
master-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION |
| 45 |
master-bin.000002 # Gtid_list # # [#-#-#] |
| 46 |
master-bin.000002 # Binlog_checkpoint # # master-bin.000001 |
| 47 |
SELECT count(*) as 'ONE' from t1; |
| 48 |
ONE |
| 49 |
1 |
| 50 |
connection default; |
| 51 |
DROP TABLE t1; |
| 52 |
SET debug_sync = 'reset'; |