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