Loading mysql-test/extra/binlog_tests/binlog_insert_delayed.test +40 −16 Original line number Diff line number Diff line # Test of binlogging of INSERT_ID with INSERT DELAYED # ==== Purpose ==== # # Verify that INSERT DELAYED in mixed or row mode writes events to the # binlog, and that AUTO_INCREMENT works correctly. # # ==== Method ==== # # Insert both single and multiple rows into an autoincrement column, # both with specified value and with NULL. # # With INSERT DELAYED, the rows do not show up in the table # immediately, so we must do source include/wait_until_rows_count.inc # between any two INSERT DELAYED statements. Moreover, if mixed or # row-based logging is used, there is also a delay between when rows # show up in the table and when they show up in the binlog. To ensure # that the rows show up in the binlog, we call FLUSH TABLES, which # waits until the delayed_insert thread has finished. # # We cannot read the binlog after executing INSERT DELAYED statements # that insert multiple rows, because that is nondeterministic. More # precisely, rows may be written in batches to the binlog, where each # batch has one Table_map_log_event and one or more # Write_rows_log_event. The number of rows included in each batch is # nondeterministic. # # ==== Related bugs ==== # # BUG#20627: INSERT DELAYED does not honour auto_increment_* variables # Bug in this test: BUG#38068: binlog_stm_binlog fails sporadically in pushbuild create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; # First, avoid BUG#20627: 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; # use this macro instead of sleeps. let $table=t1; let $count=0; insert delayed into t1 values (207); inc $count; --source include/wait_until_rows_count.inc insert delayed into t1 values (null); inc $count; --source include/wait_until_rows_count.inc Loading @@ -20,9 +46,10 @@ insert delayed into t1 values (300); 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 # It is not enough to wait until all rows have been inserted into the # table. FLUSH TABLES ensures that they are in the binlog too. See # comment above. FLUSH TABLES; source include/show_binlog_events.inc; insert delayed into t1 values (null),(null),(null),(null); Loading @@ -33,8 +60,5 @@ 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/extra/rpl_tests/rpl_row_basic.test +36 −24 Original line number Diff line number Diff line Loading @@ -309,46 +309,46 @@ sync_slave_with_master; # 7. Replicating UTF-8 CHAR(255) to CHAR(255) UTF-8 connection master; CREATE TABLE t1 (i INT NOT NULL, eval CREATE TABLE t1 (i INT NOT NULL, c CHAR(16) CHARACTER SET utf8 NOT NULL, j INT NOT NULL); j INT NOT NULL) ENGINE = $type ; CREATE TABLE t2 (i INT NOT NULL, eval CREATE TABLE t2 (i INT NOT NULL, c CHAR(16) CHARACTER SET utf8 NOT NULL, j INT NOT NULL); j INT NOT NULL) ENGINE = $type ; sync_slave_with_master; ALTER TABLE t2 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL; connection master; CREATE TABLE t3 (i INT NOT NULL, eval CREATE TABLE t3 (i INT NOT NULL, c CHAR(128) CHARACTER SET utf8 NOT NULL, j INT NOT NULL); j INT NOT NULL) ENGINE = $type ; sync_slave_with_master; ALTER TABLE t3 MODIFY c CHAR(16) CHARACTER SET utf8 NOT NULL; connection master; CREATE TABLE t4 (i INT NOT NULL, eval CREATE TABLE t4 (i INT NOT NULL, c CHAR(128) CHARACTER SET utf8 NOT NULL, j INT NOT NULL); j INT NOT NULL) ENGINE = $type ; CREATE TABLE t5 (i INT NOT NULL, eval CREATE TABLE t5 (i INT NOT NULL, c CHAR(255) CHARACTER SET utf8 NOT NULL, j INT NOT NULL); j INT NOT NULL) ENGINE = $type ; sync_slave_with_master; ALTER TABLE t5 MODIFY c CHAR(16) CHARACTER SET utf8 NOT NULL; connection master; CREATE TABLE t6 (i INT NOT NULL, eval CREATE TABLE t6 (i INT NOT NULL, c CHAR(255) CHARACTER SET utf8 NOT NULL, j INT NOT NULL); j INT NOT NULL) ENGINE = $type ; sync_slave_with_master; ALTER TABLE t6 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL; connection master; CREATE TABLE t7 (i INT NOT NULL, eval CREATE TABLE t7 (i INT NOT NULL, c CHAR(255) CHARACTER SET utf8 NOT NULL, j INT NOT NULL); j INT NOT NULL) ENGINE = $type ; --echo [expecting slave to replicate correctly] connection master; Loading Loading @@ -381,7 +381,11 @@ let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); disable_query_log; eval SELECT "$last_error" AS Last_SQL_Error; enable_query_log; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=8; connection master; RESET MASTER; connection slave; STOP SLAVE; RESET SLAVE; START SLAVE; source include/wait_for_slave_to_start.inc; Loading @@ -406,7 +410,11 @@ let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); disable_query_log; eval SELECT "$last_error" AS Last_SQL_Error; enable_query_log; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=8; connection master; RESET MASTER; connection slave; STOP SLAVE; RESET SLAVE; START SLAVE; source include/wait_for_slave_to_start.inc; Loading @@ -421,7 +429,11 @@ let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); disable_query_log; eval SELECT "$last_error" AS Last_SQL_Error; enable_query_log; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=8; connection master; RESET MASTER; connection slave; STOP SLAVE; RESET SLAVE; START SLAVE; source include/wait_for_slave_to_start.inc; Loading mysql-test/include/show_binlog_events.inc +2 −2 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ if (!$binlog_start) { let $binlog_start=106; } --replace_result $binlog_start <binlog_start> --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start> --replace_column 2 # 4 # 5 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ --eval show binlog events from $binlog_start mysql-test/suite/binlog/r/binlog_killed_simulate.result +1 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ load data infile '../std_data_ln/rpl_loaddata.dat' into table t2 /* will be "kil ERROR 70100: Query execution was interrupted show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=12 master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=# master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */ ;file_id=# select (@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) Loading mysql-test/suite/binlog/r/binlog_row_binlog.result +2 −2 Original line number Diff line number Diff line Loading @@ -1141,10 +1141,10 @@ master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # use `mysql`; COMMIT drop table t1,t2,t3,tt1; 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; insert delayed into t1 values (207); insert delayed into t1 values (null); insert delayed into t1 values (300); FLUSH TABLES; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key) Loading Loading @@ -1188,9 +1188,9 @@ master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; FLUSH TABLES 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 Loading
mysql-test/extra/binlog_tests/binlog_insert_delayed.test +40 −16 Original line number Diff line number Diff line # Test of binlogging of INSERT_ID with INSERT DELAYED # ==== Purpose ==== # # Verify that INSERT DELAYED in mixed or row mode writes events to the # binlog, and that AUTO_INCREMENT works correctly. # # ==== Method ==== # # Insert both single and multiple rows into an autoincrement column, # both with specified value and with NULL. # # With INSERT DELAYED, the rows do not show up in the table # immediately, so we must do source include/wait_until_rows_count.inc # between any two INSERT DELAYED statements. Moreover, if mixed or # row-based logging is used, there is also a delay between when rows # show up in the table and when they show up in the binlog. To ensure # that the rows show up in the binlog, we call FLUSH TABLES, which # waits until the delayed_insert thread has finished. # # We cannot read the binlog after executing INSERT DELAYED statements # that insert multiple rows, because that is nondeterministic. More # precisely, rows may be written in batches to the binlog, where each # batch has one Table_map_log_event and one or more # Write_rows_log_event. The number of rows included in each batch is # nondeterministic. # # ==== Related bugs ==== # # BUG#20627: INSERT DELAYED does not honour auto_increment_* variables # Bug in this test: BUG#38068: binlog_stm_binlog fails sporadically in pushbuild create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; # First, avoid BUG#20627: 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; # use this macro instead of sleeps. let $table=t1; let $count=0; insert delayed into t1 values (207); inc $count; --source include/wait_until_rows_count.inc insert delayed into t1 values (null); inc $count; --source include/wait_until_rows_count.inc Loading @@ -20,9 +46,10 @@ insert delayed into t1 values (300); 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 # It is not enough to wait until all rows have been inserted into the # table. FLUSH TABLES ensures that they are in the binlog too. See # comment above. FLUSH TABLES; source include/show_binlog_events.inc; insert delayed into t1 values (null),(null),(null),(null); Loading @@ -33,8 +60,5 @@ 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/extra/rpl_tests/rpl_row_basic.test +36 −24 Original line number Diff line number Diff line Loading @@ -309,46 +309,46 @@ sync_slave_with_master; # 7. Replicating UTF-8 CHAR(255) to CHAR(255) UTF-8 connection master; CREATE TABLE t1 (i INT NOT NULL, eval CREATE TABLE t1 (i INT NOT NULL, c CHAR(16) CHARACTER SET utf8 NOT NULL, j INT NOT NULL); j INT NOT NULL) ENGINE = $type ; CREATE TABLE t2 (i INT NOT NULL, eval CREATE TABLE t2 (i INT NOT NULL, c CHAR(16) CHARACTER SET utf8 NOT NULL, j INT NOT NULL); j INT NOT NULL) ENGINE = $type ; sync_slave_with_master; ALTER TABLE t2 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL; connection master; CREATE TABLE t3 (i INT NOT NULL, eval CREATE TABLE t3 (i INT NOT NULL, c CHAR(128) CHARACTER SET utf8 NOT NULL, j INT NOT NULL); j INT NOT NULL) ENGINE = $type ; sync_slave_with_master; ALTER TABLE t3 MODIFY c CHAR(16) CHARACTER SET utf8 NOT NULL; connection master; CREATE TABLE t4 (i INT NOT NULL, eval CREATE TABLE t4 (i INT NOT NULL, c CHAR(128) CHARACTER SET utf8 NOT NULL, j INT NOT NULL); j INT NOT NULL) ENGINE = $type ; CREATE TABLE t5 (i INT NOT NULL, eval CREATE TABLE t5 (i INT NOT NULL, c CHAR(255) CHARACTER SET utf8 NOT NULL, j INT NOT NULL); j INT NOT NULL) ENGINE = $type ; sync_slave_with_master; ALTER TABLE t5 MODIFY c CHAR(16) CHARACTER SET utf8 NOT NULL; connection master; CREATE TABLE t6 (i INT NOT NULL, eval CREATE TABLE t6 (i INT NOT NULL, c CHAR(255) CHARACTER SET utf8 NOT NULL, j INT NOT NULL); j INT NOT NULL) ENGINE = $type ; sync_slave_with_master; ALTER TABLE t6 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL; connection master; CREATE TABLE t7 (i INT NOT NULL, eval CREATE TABLE t7 (i INT NOT NULL, c CHAR(255) CHARACTER SET utf8 NOT NULL, j INT NOT NULL); j INT NOT NULL) ENGINE = $type ; --echo [expecting slave to replicate correctly] connection master; Loading Loading @@ -381,7 +381,11 @@ let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); disable_query_log; eval SELECT "$last_error" AS Last_SQL_Error; enable_query_log; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=8; connection master; RESET MASTER; connection slave; STOP SLAVE; RESET SLAVE; START SLAVE; source include/wait_for_slave_to_start.inc; Loading @@ -406,7 +410,11 @@ let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); disable_query_log; eval SELECT "$last_error" AS Last_SQL_Error; enable_query_log; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=8; connection master; RESET MASTER; connection slave; STOP SLAVE; RESET SLAVE; START SLAVE; source include/wait_for_slave_to_start.inc; Loading @@ -421,7 +429,11 @@ let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); disable_query_log; eval SELECT "$last_error" AS Last_SQL_Error; enable_query_log; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=8; connection master; RESET MASTER; connection slave; STOP SLAVE; RESET SLAVE; START SLAVE; source include/wait_for_slave_to_start.inc; Loading
mysql-test/include/show_binlog_events.inc +2 −2 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ if (!$binlog_start) { let $binlog_start=106; } --replace_result $binlog_start <binlog_start> --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start> --replace_column 2 # 4 # 5 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ --eval show binlog events from $binlog_start
mysql-test/suite/binlog/r/binlog_killed_simulate.result +1 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ load data infile '../std_data_ln/rpl_loaddata.dat' into table t2 /* will be "kil ERROR 70100: Query execution was interrupted show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=12 master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=# master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */ ;file_id=# select (@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) Loading
mysql-test/suite/binlog/r/binlog_row_binlog.result +2 −2 Original line number Diff line number Diff line Loading @@ -1141,10 +1141,10 @@ master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # use `mysql`; COMMIT drop table t1,t2,t3,tt1; 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; insert delayed into t1 values (207); insert delayed into t1 values (null); insert delayed into t1 values (300); FLUSH TABLES; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key) Loading Loading @@ -1188,9 +1188,9 @@ master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; FLUSH TABLES 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