#At file:///home/lsoares/Workspace/bzr/work/bugfixing/12416768/mysql-trunk/ based on revid:alexander.nozdrin@stripped
3384 Luis Soares 2011-05-10
BUG#12416768: RPL_ROW_IGNORABLE_EVENT FAILS SPORADICALLY ON PB2,
RESULT MISMATCH MYSQLBINLOG
There could be a race between the insert delayed thread and the
user thread issuing the DDL statement.
We fix this by making sure in the test case that the DDL statement
is issued only after the delayed thread terminates. We force it
to terminate by resorting to the FLUSH TABLES command. In addition
we also deploy two assertions:
- assert that there are 0 delayed threads after FLUSH TABLES
- assert that before the DDL, there was actually something written
to the binary log as part of the INSERT DELAYED operation
modified:
mysql-test/suite/rpl/r/rpl_row_ignorable_event.result
mysql-test/suite/rpl/t/rpl_row_ignorable_event.test
=== modified file 'mysql-test/suite/rpl/r/rpl_row_ignorable_event.result'
--- a/mysql-test/suite/rpl/r/rpl_row_ignorable_event.result 2011-01-21 11:30:47 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_ignorable_event.result 2011-05-10 10:45:25 +0000
@@ -36,6 +36,8 @@ insert into t5(a, b) values(3,1);
# Test the Rows_query log event will be filtered out if slave filters
# out all its related tables by replication filtering rules
update t4,t5 set t4.a=4, t5.a=5 where t4.b=t5.b;
+FLUSH TABLES;
+# Assert that no delayed thread handlers exist
SET @old_debug= @@global.debug;
SET GLOBAL debug="+d,after_handle_inserts";
set DEBUG_SYNC= 'before_write_delayed SIGNAL before_insert EXECUTE 3';
@@ -43,6 +45,9 @@ set DEBUG_SYNC= 'after_write_delayed WAI
# Test insert delayed ...
insert delayed into t3(a,b) values(1,5),(1,6),(1,7);
SET @@global.debug= @old_debug;
+FLUSH TABLES t3;
+# Assert that no delayed thread handlers exist for table t3
+include/assert.inc [Assert that insert delayed related data has been written to the binary log]
# Test load data infile
create table t6(a VARCHAR(60)) engine= myisam;
load data infile '../../std_data/words.dat' into table t6;
@@ -129,6 +134,7 @@ master-bin.000001 # Table_map # # table_
master-bin.000001 # Table_map # # table_id: # (test.t5)
master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; FLUSH TABLES
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Rows_query # # # insert delayed into t3(a,b) values(1,5),(1,6),(1,7)
master-bin.000001 # Table_map # # table_id: # (test.t3)
@@ -138,6 +144,7 @@ master-bin.000001 # Write_rows # # table
master-bin.000001 # Table_map # # table_id: # (test.t3)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; FLUSH TABLES t3
master-bin.000001 # Query # # use `test`; create table t6(a VARCHAR(60)) engine= myisam
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Rows_query # # # load data infile '../../std_data/words.dat' into table t6
@@ -518,6 +525,11 @@ COMMIT
# at #
#server id # end_log_pos # Query thread_id=# exec_time=# error_code=#
SET TIMESTAMP=t/*!*/;
+FLUSH TABLES
+/*!*/;
+# at #
+#server id # end_log_pos # Query thread_id=# exec_time=# error_code=#
+SET TIMESTAMP=t/*!*/;
BEGIN
/*!*/;
# at #
@@ -555,6 +567,11 @@ COMMIT
# at #
#server id # end_log_pos # Query thread_id=# exec_time=# error_code=#
SET TIMESTAMP=t/*!*/;
+FLUSH TABLES t3
+/*!*/;
+# at #
+#server id # end_log_pos # Query thread_id=# exec_time=# error_code=#
+SET TIMESTAMP=t/*!*/;
create table t6(a VARCHAR(60)) engine= myisam
/*!*/;
# at #
@@ -943,6 +960,7 @@ slave-bin.000001 # Rows_query # # # upda
slave-bin.000001 # Table_map # # table_id: # (test.t3)
slave-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Query # # use `test`; FLUSH TABLES
slave-bin.000001 # Query # # BEGIN
slave-bin.000001 # Rows_query # # # insert delayed into t3(a,b) values(1,5),(1,6),(1,7)
slave-bin.000001 # Table_map # # table_id: # (test.t3)
@@ -956,6 +974,7 @@ slave-bin.000001 # Query # # BEGIN
slave-bin.000001 # Table_map # # table_id: # (test.t3)
slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Query # # use `test`; FLUSH TABLES t3
slave-bin.000001 # Query # # use `test`; create table t6(a VARCHAR(60)) engine= myisam
slave-bin.000001 # Query # # BEGIN
slave-bin.000001 # Rows_query # # # load data infile '../../std_data/words.dat' into table t6
=== modified file 'mysql-test/suite/rpl/t/rpl_row_ignorable_event.test'
--- a/mysql-test/suite/rpl/t/rpl_row_ignorable_event.test 2011-01-21 11:30:47 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_ignorable_event.test 2011-05-10 10:45:25 +0000
@@ -58,10 +58,17 @@ insert into t5(a, b) values(3,1);
--echo # out all its related tables by replication filtering rules
update t4,t5 set t4.a=4, t5.a=5 where t4.b=t5.b;
+FLUSH TABLES;
+--echo # Assert that no delayed thread handlers exist
+--let $status_var= delayed_insert_threads
+--let $status_var_value= 0
+--source include/wait_for_status_var.inc
+
SET @old_debug= @@global.debug;
SET GLOBAL debug="+d,after_handle_inserts";
set DEBUG_SYNC= 'before_write_delayed SIGNAL before_insert EXECUTE 3';
set DEBUG_SYNC= 'after_write_delayed WAIT_FOR inserts_handled EXECUTE 3';
+--let $pos_before_insert_delayed=query_get_value(SHOW MASTER STATUS, Position, 1)
--echo # Test insert delayed ...
let $table=t3;
insert delayed into t3(a,b) values(1,5),(1,6),(1,7);
@@ -69,6 +76,20 @@ let $count=4;
--source include/wait_until_rows_count.inc
SET @@global.debug= @old_debug;
+# this makes sure that the delayed thread will
+# have stopped and written to the binary log
+FLUSH TABLES t3;
+--echo # Assert that no delayed thread handlers exist for table t3
+--let $status_var= delayed_insert_threads
+--let $status_var_value= 0
+--source include/wait_for_status_var.inc
+
+# this is just for a sanity check after BUG#12416768
+--let $pos_after_insert_delayed=query_get_value(SHOW MASTER STATUS, Position, 1)
+--let $assert_text= Assert that insert delayed related data has been written to the binary log
+--let $assert_cond= $pos_after_insert_delayed <> $pos_before_insert_delayed
+--source include/assert.inc
+
--echo # Test load data infile
create table t6(a VARCHAR(60)) engine= myisam;
load data infile '../../std_data/words.dat' into table t6;
Attachment: [text/bzr-bundle] bzr/luis.soares@oracle.com-20110510104525-oh30ha25uksonp4s.bundle
| Thread |
|---|
| • bzr commit into mysql-trunk branch (luis.soares:3384) Bug#12416768 | Luis Soares | 10 May |