Loading include/my_bitmap.h +16 −0 Original line number Diff line number Diff line Loading @@ -159,6 +159,22 @@ static inline my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2) #define bitmap_set_all(MAP) \ (memset((MAP)->bitmap, 0xFF, 4*no_words_in_map((MAP)))) /** check, set and clear a bit of interest of an integer. If the bit is out of range @retval -1. Otherwise bit_is_set @return 0 or 1 reflecting the bit is set or not; bit_do_set @return 1 (bit is set 1) bit_do_clear @return 0 (bit is cleared to 0) */ #define bit_is_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ (((I) & (ULL(1) << (B))) == 0 ? 0 : 1) : -1) #define bit_do_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ ((I) |= (ULL(1) << (B)), 1) : -1) #define bit_do_clear(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ ((I) &= ~(ULL(1) << (B)), 0) : -1) #ifdef __cplusplus } #endif Loading mysql-test/extra/rpl_tests/rpl_foreign_key.test +31 −0 Original line number Diff line number Diff line Loading @@ -32,3 +32,34 @@ SET FOREIGN_KEY_CHECKS=0; DROP TABLE IF EXISTS t1,t2,t3; SET FOREIGN_KEY_CHECKS=1; sync_slave_with_master; # # Bug #32468 delete rows event on a table with foreign key constraint fails # connection master; eval create table t1 (b int primary key) engine = $engine_type; eval create table t2 (a int primary key, b int, foreign key (b) references t1(b)) engine = $engine_type; insert into t1 set b=1; insert into t2 set a=1, b=1; set foreign_key_checks=0; set @@session.binlog_format=row; delete from t1; --echo must sync w/o a problem (could not with the buggy code) sync_slave_with_master; select count(*) from t1 /* must be zero */; # cleanup for bug#32468 connection master; drop table t2,t1; sync_slave_with_master; mysql-test/extra/rpl_tests/rpl_row_basic.test +19 −0 Original line number Diff line number Diff line Loading @@ -174,11 +174,18 @@ sync_slave_with_master; INSERT INTO t7 VALUES (1,3), (2,6), (3,9); SELECT * FROM t7 ORDER BY C1; # since bug#31552/31609 idempotency is not default any longer. In order # the preceeding test INSERT INTO t7 to pass the mode is switched # temprorarily set @@global.slave_exec_mode= 'IDEMPOTENT'; connection master; --echo --- on master: new values inserted --- INSERT INTO t7 VALUES (1,2), (2,4), (3,6); SELECT * FROM t7 ORDER BY C1; sync_slave_with_master; set @@global.slave_exec_mode= default; --echo --- on slave: old values should be overwritten by replicated values --- SELECT * FROM t7 ORDER BY C1; Loading Loading @@ -206,12 +213,19 @@ SELECT * FROM t8 ORDER BY a; INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9); SELECT * FROM t8 ORDER BY a; # since bug#31552/31609 idempotency is not default any longer. In order # the preceeding test INSERT INTO t8 to pass the mode is switched # temprorarily set @@global.slave_exec_mode= 'IDEMPOTENT'; connection master; --echo --- on master --- # We insert a row that will cause conflict on the primary key but not # on the other keys. INSERT INTO t8 VALUES (2,4,8); sync_slave_with_master; set @@global.slave_exec_mode= default; --echo --- on slave --- SELECT * FROM t8 ORDER BY a; Loading @@ -234,12 +248,17 @@ connection master; INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M'); --echo **** On Master **** sync_slave_with_master; # since bug#31552/31609 idempotency is not default any longer. In order # the following test DELETE FROM t1 to pass the mode is switched # temprorarily set @@global.slave_exec_mode= 'IDEMPOTENT'; DELETE FROM t1 WHERE C1 = 'L'; connection master; DELETE FROM t1; query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2; sync_slave_with_master; set @@global.slave_exec_mode= default; let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); disable_query_log; eval SELECT "$last_error" AS Last_SQL_Error; Loading mysql-test/extra/rpl_tests/rpl_row_tabledefs.test +7 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,11 @@ ALTER TABLE t8 ADD e1 INT NOT NULL DEFAULT 0, ADD e2 INT NOT NULL DEFAULT 0, # Insert some values for tables on slave side. These should not be # modified when the row from the master is applied. # since bug#31552/31609 idempotency is not default any longer. In order # the following INSERTs to pass the mode is switched temprorarily set @@global.slave_exec_mode= 'IDEMPOTENT'; # so the inserts are going to be overriden INSERT INTO t1_int VALUES (2, 4, 4711); INSERT INTO t1_char VALUES (2, 4, 'Foo is a bar'); INSERT INTO t1_bit VALUES (2, 4, b'101', b'11100', b'01'); Loading @@ -86,6 +91,8 @@ SELECT * FROM t1_bit ORDER BY a; SELECT * FROM t1_char ORDER BY a; --echo **** On Slave **** sync_slave_with_master; set @@global.slave_exec_mode= default; SELECT a,b,x FROM t1_int ORDER BY a; SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a; SELECT a,b,x FROM t1_char ORDER BY a; Loading mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result +13 −0 Original line number Diff line number Diff line Loading @@ -40,3 +40,16 @@ Got one of the listed errors SET FOREIGN_KEY_CHECKS=0; DROP TABLE IF EXISTS t1,t2,t3; SET FOREIGN_KEY_CHECKS=1; create table t1 (b int primary key) engine = INNODB; create table t2 (a int primary key, b int, foreign key (b) references t1(b)) engine = INNODB; insert into t1 set b=1; insert into t2 set a=1, b=1; set foreign_key_checks=0; set @@session.binlog_format=row; delete from t1; must sync w/o a problem (could not with the buggy code) select count(*) from t1 /* must be zero */; count(*) 0 drop table t2,t1; Loading
include/my_bitmap.h +16 −0 Original line number Diff line number Diff line Loading @@ -159,6 +159,22 @@ static inline my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2) #define bitmap_set_all(MAP) \ (memset((MAP)->bitmap, 0xFF, 4*no_words_in_map((MAP)))) /** check, set and clear a bit of interest of an integer. If the bit is out of range @retval -1. Otherwise bit_is_set @return 0 or 1 reflecting the bit is set or not; bit_do_set @return 1 (bit is set 1) bit_do_clear @return 0 (bit is cleared to 0) */ #define bit_is_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ (((I) & (ULL(1) << (B))) == 0 ? 0 : 1) : -1) #define bit_do_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ ((I) |= (ULL(1) << (B)), 1) : -1) #define bit_do_clear(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ ((I) &= ~(ULL(1) << (B)), 0) : -1) #ifdef __cplusplus } #endif Loading
mysql-test/extra/rpl_tests/rpl_foreign_key.test +31 −0 Original line number Diff line number Diff line Loading @@ -32,3 +32,34 @@ SET FOREIGN_KEY_CHECKS=0; DROP TABLE IF EXISTS t1,t2,t3; SET FOREIGN_KEY_CHECKS=1; sync_slave_with_master; # # Bug #32468 delete rows event on a table with foreign key constraint fails # connection master; eval create table t1 (b int primary key) engine = $engine_type; eval create table t2 (a int primary key, b int, foreign key (b) references t1(b)) engine = $engine_type; insert into t1 set b=1; insert into t2 set a=1, b=1; set foreign_key_checks=0; set @@session.binlog_format=row; delete from t1; --echo must sync w/o a problem (could not with the buggy code) sync_slave_with_master; select count(*) from t1 /* must be zero */; # cleanup for bug#32468 connection master; drop table t2,t1; sync_slave_with_master;
mysql-test/extra/rpl_tests/rpl_row_basic.test +19 −0 Original line number Diff line number Diff line Loading @@ -174,11 +174,18 @@ sync_slave_with_master; INSERT INTO t7 VALUES (1,3), (2,6), (3,9); SELECT * FROM t7 ORDER BY C1; # since bug#31552/31609 idempotency is not default any longer. In order # the preceeding test INSERT INTO t7 to pass the mode is switched # temprorarily set @@global.slave_exec_mode= 'IDEMPOTENT'; connection master; --echo --- on master: new values inserted --- INSERT INTO t7 VALUES (1,2), (2,4), (3,6); SELECT * FROM t7 ORDER BY C1; sync_slave_with_master; set @@global.slave_exec_mode= default; --echo --- on slave: old values should be overwritten by replicated values --- SELECT * FROM t7 ORDER BY C1; Loading Loading @@ -206,12 +213,19 @@ SELECT * FROM t8 ORDER BY a; INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9); SELECT * FROM t8 ORDER BY a; # since bug#31552/31609 idempotency is not default any longer. In order # the preceeding test INSERT INTO t8 to pass the mode is switched # temprorarily set @@global.slave_exec_mode= 'IDEMPOTENT'; connection master; --echo --- on master --- # We insert a row that will cause conflict on the primary key but not # on the other keys. INSERT INTO t8 VALUES (2,4,8); sync_slave_with_master; set @@global.slave_exec_mode= default; --echo --- on slave --- SELECT * FROM t8 ORDER BY a; Loading @@ -234,12 +248,17 @@ connection master; INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M'); --echo **** On Master **** sync_slave_with_master; # since bug#31552/31609 idempotency is not default any longer. In order # the following test DELETE FROM t1 to pass the mode is switched # temprorarily set @@global.slave_exec_mode= 'IDEMPOTENT'; DELETE FROM t1 WHERE C1 = 'L'; connection master; DELETE FROM t1; query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2; sync_slave_with_master; set @@global.slave_exec_mode= default; let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); disable_query_log; eval SELECT "$last_error" AS Last_SQL_Error; Loading
mysql-test/extra/rpl_tests/rpl_row_tabledefs.test +7 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,11 @@ ALTER TABLE t8 ADD e1 INT NOT NULL DEFAULT 0, ADD e2 INT NOT NULL DEFAULT 0, # Insert some values for tables on slave side. These should not be # modified when the row from the master is applied. # since bug#31552/31609 idempotency is not default any longer. In order # the following INSERTs to pass the mode is switched temprorarily set @@global.slave_exec_mode= 'IDEMPOTENT'; # so the inserts are going to be overriden INSERT INTO t1_int VALUES (2, 4, 4711); INSERT INTO t1_char VALUES (2, 4, 'Foo is a bar'); INSERT INTO t1_bit VALUES (2, 4, b'101', b'11100', b'01'); Loading @@ -86,6 +91,8 @@ SELECT * FROM t1_bit ORDER BY a; SELECT * FROM t1_char ORDER BY a; --echo **** On Slave **** sync_slave_with_master; set @@global.slave_exec_mode= default; SELECT a,b,x FROM t1_int ORDER BY a; SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a; SELECT a,b,x FROM t1_char ORDER BY a; Loading
mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result +13 −0 Original line number Diff line number Diff line Loading @@ -40,3 +40,16 @@ Got one of the listed errors SET FOREIGN_KEY_CHECKS=0; DROP TABLE IF EXISTS t1,t2,t3; SET FOREIGN_KEY_CHECKS=1; create table t1 (b int primary key) engine = INNODB; create table t2 (a int primary key, b int, foreign key (b) references t1(b)) engine = INNODB; insert into t1 set b=1; insert into t2 set a=1, b=1; set foreign_key_checks=0; set @@session.binlog_format=row; delete from t1; must sync w/o a problem (could not with the buggy code) select count(*) from t1 /* must be zero */; count(*) 0 drop table t2,t1;