Loading mysql-test/extra/binlog_tests/binlog_insert_delayed.test +28 −14 Original line number Diff line number Diff line Loading @@ -4,25 +4,39 @@ create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1; # Verify that only one INSERT_ID event is binlogged. # Note, that because of WL#3368 mixed mode binlog records RBR events for the delayed let $table=t1; let $rows_inserted=11; # total number of inserted rows in this test insert delayed into t1 values (207); let $count=1; # We use sleeps between statements, that's the only way to get a # repeatable binlog in a normal test run and under Valgrind. The # reason is that without sleeps, rows of different INSERT DELAYEDs # sometimes group together and sometimes not, so the table may be # unlocked/relocked causing a different number of table map log # events. sleep 2; # use this macro instead of sleeps. --source include/wait_until_rows_count.inc insert delayed into t1 values (null); sleep 2; inc $count; --source include/wait_until_rows_count.inc insert delayed into t1 values (300); sleep 2; # time for the delayed queries to reach disk insert delayed into t1 values (null),(null),(null),(null); sleep 2; insert delayed into t1 values (null),(null),(400),(null); sleep 2; select * from t1; inc $count; --source include/wait_until_rows_count.inc # moving binlog check affront of multi-rows queries which work is indeterministic (extra table_maps) # todo: better check is to substitute SHOW BINLOG with reading from binlog, probably bug#19459 is in # the way --replace_column 2 # 5 # --replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; insert delayed into t1 values (null),(null),(null),(null); inc $count; inc $count; inc $count; inc $count; --source include/wait_until_rows_count.inc insert delayed into t1 values (null),(null),(400),(null); inc $count; inc $count; inc $count; inc $count; --source include/wait_until_rows_count.inc #check this assertion about $count calculation --echo $count == $rows_inserted select * from t1; drop table t1; mysql-test/include/wait_until_rows_count.inc 0 → 100644 +52 −0 Original line number Diff line number Diff line # include/wait_until_rows_count.inc # inspired by wait_for_slave_status by Matthias Leich # # SUMMARY # # Waits until SELECT count(*)-$count from $table returns zero # # USAGE # # Set vars like # let $count=11; # let $table=t1; # # invoke the macro # --include wait_until_rows_count.inc # # EXAMPLE # extra/binlog/binlog_insert_delayed.test # # # TODO: generalize up to wait_[until|while] with arbitrary select or even query and # a condition to wait or get awakened # It's impossible to implement such a "most" general macro without # extending mysqltest. Just no way to pass a query as an argument and # evaluate it here, like eval "$quuery". One is bound # to specify it inside of the macro --disable_query_log let $wait_counter= 300; # max wait in 0.1 seconds while ($wait_counter) { eval select count(*)-$count from $table into @rez; let $rez=`select @rez`; let $success=`SELECT @rez = 0`; let $no_success=1; if ($success) { let $wait_counter= 1; # droppping counter to leave loop let $no_success=0; } if ($no_success) { --sleep 0.1 } dec $wait_counter; } --enable_query_log if ($no_success) { --die Timeout in wait_until_rows_count.inc, required table never had a prescribed number of rows. } mysql-test/r/binlog_row_binlog.result +14 −21 Original line number Diff line number Diff line Loading @@ -250,8 +250,22 @@ set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1; insert delayed into t1 values (207); insert delayed into t1 values (null); insert delayed into t1 values (300); show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_increment primary key) master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F insert delayed into t1 values (null),(null),(null),(null); insert delayed into t1 values (null),(null),(400),(null); 11 == 11 select * from t1; a 207 Loading @@ -265,25 +279,4 @@ a 306 400 401 show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_increment primary key) master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F drop table t1; mysql-test/r/binlog_statement_insert_delayed.result +8 −11 Original line number Diff line number Diff line Loading @@ -3,8 +3,16 @@ set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1; insert delayed into t1 values (207); insert delayed into t1 values (null); insert delayed into t1 values (300); show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (207) master-bin.000001 # Intvar 1 # INSERT_ID=208 master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (null) master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (300) insert delayed into t1 values (null),(null),(null),(null); insert delayed into t1 values (null),(null),(400),(null); 11 == 11 select * from t1; a 207 Loading @@ -18,15 +26,4 @@ a 306 400 401 show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (207) master-bin.000001 # Intvar 1 # INSERT_ID=208 master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (null) master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (300) master-bin.000001 # Intvar 1 # INSERT_ID=301 master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (null),(null),(null),(null) master-bin.000001 # Intvar 1 # INSERT_ID=305 master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (null),(null),(400),(null) drop table t1; mysql-test/r/binlog_stm_binlog.result +14 −21 Original line number Diff line number Diff line Loading @@ -160,8 +160,22 @@ set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1; insert delayed into t1 values (207); insert delayed into t1 values (null); insert delayed into t1 values (300); show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_increment primary key) master-bin.000001 # Intvar 1 # INSERT_ID=127 master-bin.000001 # Query 1 # use `test`; insert into t1 values(null) master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F insert delayed into t1 values (null),(null),(null),(null); insert delayed into t1 values (null),(null),(400),(null); 11 == 11 select * from t1; a 207 Loading @@ -175,25 +189,4 @@ a 306 400 401 show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_increment primary key) master-bin.000001 # Intvar 1 # INSERT_ID=127 master-bin.000001 # Query 1 # use `test`; insert into t1 values(null) master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F drop table t1; Loading
mysql-test/extra/binlog_tests/binlog_insert_delayed.test +28 −14 Original line number Diff line number Diff line Loading @@ -4,25 +4,39 @@ create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1; # Verify that only one INSERT_ID event is binlogged. # Note, that because of WL#3368 mixed mode binlog records RBR events for the delayed let $table=t1; let $rows_inserted=11; # total number of inserted rows in this test insert delayed into t1 values (207); let $count=1; # We use sleeps between statements, that's the only way to get a # repeatable binlog in a normal test run and under Valgrind. The # reason is that without sleeps, rows of different INSERT DELAYEDs # sometimes group together and sometimes not, so the table may be # unlocked/relocked causing a different number of table map log # events. sleep 2; # use this macro instead of sleeps. --source include/wait_until_rows_count.inc insert delayed into t1 values (null); sleep 2; inc $count; --source include/wait_until_rows_count.inc insert delayed into t1 values (300); sleep 2; # time for the delayed queries to reach disk insert delayed into t1 values (null),(null),(null),(null); sleep 2; insert delayed into t1 values (null),(null),(400),(null); sleep 2; select * from t1; inc $count; --source include/wait_until_rows_count.inc # moving binlog check affront of multi-rows queries which work is indeterministic (extra table_maps) # todo: better check is to substitute SHOW BINLOG with reading from binlog, probably bug#19459 is in # the way --replace_column 2 # 5 # --replace_regex /table_id: [0-9]+/table_id: #/ show binlog events from 102; insert delayed into t1 values (null),(null),(null),(null); inc $count; inc $count; inc $count; inc $count; --source include/wait_until_rows_count.inc insert delayed into t1 values (null),(null),(400),(null); inc $count; inc $count; inc $count; inc $count; --source include/wait_until_rows_count.inc #check this assertion about $count calculation --echo $count == $rows_inserted select * from t1; drop table t1;
mysql-test/include/wait_until_rows_count.inc 0 → 100644 +52 −0 Original line number Diff line number Diff line # include/wait_until_rows_count.inc # inspired by wait_for_slave_status by Matthias Leich # # SUMMARY # # Waits until SELECT count(*)-$count from $table returns zero # # USAGE # # Set vars like # let $count=11; # let $table=t1; # # invoke the macro # --include wait_until_rows_count.inc # # EXAMPLE # extra/binlog/binlog_insert_delayed.test # # # TODO: generalize up to wait_[until|while] with arbitrary select or even query and # a condition to wait or get awakened # It's impossible to implement such a "most" general macro without # extending mysqltest. Just no way to pass a query as an argument and # evaluate it here, like eval "$quuery". One is bound # to specify it inside of the macro --disable_query_log let $wait_counter= 300; # max wait in 0.1 seconds while ($wait_counter) { eval select count(*)-$count from $table into @rez; let $rez=`select @rez`; let $success=`SELECT @rez = 0`; let $no_success=1; if ($success) { let $wait_counter= 1; # droppping counter to leave loop let $no_success=0; } if ($no_success) { --sleep 0.1 } dec $wait_counter; } --enable_query_log if ($no_success) { --die Timeout in wait_until_rows_count.inc, required table never had a prescribed number of rows. }
mysql-test/r/binlog_row_binlog.result +14 −21 Original line number Diff line number Diff line Loading @@ -250,8 +250,22 @@ set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1; insert delayed into t1 values (207); insert delayed into t1 values (null); insert delayed into t1 values (300); show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_increment primary key) master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F insert delayed into t1 values (null),(null),(null),(null); insert delayed into t1 values (null),(null),(400),(null); 11 == 11 select * from t1; a 207 Loading @@ -265,25 +279,4 @@ a 306 400 401 show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_increment primary key) master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F drop table t1;
mysql-test/r/binlog_statement_insert_delayed.result +8 −11 Original line number Diff line number Diff line Loading @@ -3,8 +3,16 @@ set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1; insert delayed into t1 values (207); insert delayed into t1 values (null); insert delayed into t1 values (300); show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (207) master-bin.000001 # Intvar 1 # INSERT_ID=208 master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (null) master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (300) insert delayed into t1 values (null),(null),(null),(null); insert delayed into t1 values (null),(null),(400),(null); 11 == 11 select * from t1; a 207 Loading @@ -18,15 +26,4 @@ a 306 400 401 show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (207) master-bin.000001 # Intvar 1 # INSERT_ID=208 master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (null) master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (300) master-bin.000001 # Intvar 1 # INSERT_ID=301 master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (null),(null),(null),(null) master-bin.000001 # Intvar 1 # INSERT_ID=305 master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (null),(null),(400),(null) drop table t1;
mysql-test/r/binlog_stm_binlog.result +14 −21 Original line number Diff line number Diff line Loading @@ -160,8 +160,22 @@ set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1; insert delayed into t1 values (207); insert delayed into t1 values (null); insert delayed into t1 values (300); show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_increment primary key) master-bin.000001 # Intvar 1 # INSERT_ID=127 master-bin.000001 # Query 1 # use `test`; insert into t1 values(null) master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F insert delayed into t1 values (null),(null),(null),(null); insert delayed into t1 values (null),(null),(400),(null); 11 == 11 select * from t1; a 207 Loading @@ -175,25 +189,4 @@ a 306 400 401 show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_increment primary key) master-bin.000001 # Intvar 1 # INSERT_ID=127 master-bin.000001 # Query 1 # use `test`; insert into t1 values(null) master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F drop table t1;