Loading mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test +14 −4 Original line number Diff line number Diff line Loading @@ -315,11 +315,21 @@ disconnect con3; connection con4; select get_lock("a",10); # wait for rollback to finish flush logs; # we check that the error code of the "ROLLBACK" event is 0 and not # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction # and does not make slave to stop) --exec $MYSQL_BINLOG --start-position=547 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output if (`select @@binlog_format = 'ROW'`) { --exec $MYSQL_BINLOG --start-position=524 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output } if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`) { --exec $MYSQL_BINLOG --start-position=555 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output } --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output")) Loading Loading @@ -360,7 +370,7 @@ rollback; select count(*) from tt /* 2 */; show master status; --replace_column 2 # 5 # show binlog events from 98; show binlog events from 106; select count(*) from ti /* zero */; insert into ti select * from tt; select * from ti /* that is what slave would miss - a bug */; Loading @@ -385,12 +395,12 @@ rollback; show master status; --replace_column 2 # 5 # show binlog events from 98; show binlog events from 106; select count(*) from ti /* zero */; insert into ti select * from tt; select * from tt /* that is what otherwise slave missed - the bug */; drop table ti; drop table ti, tt; # Loading mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result +237 −2 Original line number Diff line number Diff line Loading @@ -113,6 +113,7 @@ insert into t1 values(9); insert into t2 select * from t1; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info 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 # Xid # # COMMIT /* XID */ Loading @@ -126,6 +127,7 @@ begin; insert into t2 select * from t1; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info 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 # Xid # # COMMIT /* XID */ Loading @@ -135,6 +137,7 @@ insert into t1 values(11); commit; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info 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 # Xid # # COMMIT /* XID */ Loading Loading @@ -260,10 +263,12 @@ master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Query # # use `test`; alter table t2 engine=MyISAM 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 # Xid # # COMMIT /* XID */ Loading Loading @@ -366,6 +371,7 @@ master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2 master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb 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`; BEGIN master-bin.000001 # Query # # use `test`; TRUNCATE table t2 master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Table_map # # table_id: # (test.t1) Loading @@ -383,6 +389,7 @@ master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F 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`; BEGIN master-bin.000001 # Query # # use `test`; TRUNCATE table t2 master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Table_map # # table_id: # (test.t1) Loading @@ -408,9 +415,9 @@ is not null; is not null 1 select @a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%", @a like "%#%error_code=0%ROLLBACK\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%", @a not like "%#%error_code=%error_code=%"; @a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%" @a like "%#%error_code=0%ROLLBACK\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%" 1 1 drop table t1, t2; create temporary table tt (a int unique); Loading @@ -432,6 +439,226 @@ count(*) show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 395 show binlog events from 106; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; BEGIN master-bin.000001 # Table_map 1 # table_id: 27 (test.ti) master-bin.000001 # Write_rows 1 # table_id: 27 flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: 27 (test.ti) master-bin.000001 # Write_rows 1 # table_id: 27 flags: STMT_END_F master-bin.000001 # Query 1 # use `test`; ROLLBACK select count(*) from ti /* zero */; count(*) 0 insert into ti select * from tt; select * from ti /* that is what slave would miss - a bug */; a 1 2 delete from ti; delete from tt where a=1; reset master; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 106 begin; insert into ti values (1); insert into ti values (2) /* to make the dup error in the following */; insert into tt select * from ti /* one affected and error */; ERROR 23000: Duplicate entry '2' for key 'a' rollback; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 106 show binlog events from 106; Log_name Pos Event_type Server_id End_log_pos Info select count(*) from ti /* zero */; count(*) 0 insert into ti select * from tt; select * from tt /* that is what otherwise slave missed - the bug */; a 1 2 drop table ti, tt; drop function if exists bug27417; drop table if exists t1,t2; CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM; CREATE TABLE t2 (a int NOT NULL auto_increment, PRIMARY KEY (a)); create function bug27417(n int) RETURNS int(11) begin insert into t1 values (null); return n; end| reset master; insert into t2 values (bug27417(1)); insert into t2 select bug27417(2); reset master; insert into t2 values (bug27417(2)); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 222 /* only (!) with fixes for #23333 will show there is the query */; select count(*) from t1 /* must be 3 */; count(*) 3 reset master; select count(*) from t2; count(*) 2 delete from t2 where a=bug27417(3); select count(*) from t2 /* nothing got deleted */; count(*) 2 show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 227 /* the query must be in regardless of #23333 */; select count(*) from t1 /* must be 5 */; count(*) 5 delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */; affected rows: 0 select count(*) from t1 /* must be 7 */; count(*) 7 drop table t1,t2; CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM; CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique) ENGINE=MyISAM; CREATE TABLE t4 (a int, PRIMARY KEY (a), b int unique) ENGINE=Innodb; CREATE TABLE t5 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; insert into t2 values (1); reset master; insert into t2 values (bug27417(1)); ERROR 23000: Duplicate entry '1' for key 'PRIMARY' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 361 select count(*) from t1 /* must be 1 */; count(*) 1 delete from t1; delete from t2; insert into t2 values (2); reset master; insert into t2 select bug27417(1) union select bug27417(2); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 400 select count(*) from t1 /* must be 2 */; count(*) 2 delete from t1; insert into t3 values (1,1),(2,3),(3,4); reset master; update t3 set b=b+bug27417(1); ERROR 23000: Duplicate entry '4' for key 'b' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 305 select count(*) from t1 /* must be 2 */; count(*) 2 delete from t3; delete from t4; insert into t3 values (1,1); insert into t4 values (1,1),(2,2); reset master; UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 367 select count(*) from t1 /* must be 4 */; count(*) 4 delete from t1; delete from t3; delete from t4; insert into t3 values (1,1),(2,2); insert into t4 values (1,1),(2,2); reset master; UPDATE t3,t4 SET t3.a=t4.a + bug27417(1); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' select count(*) from t1 /* must be 1 */; count(*) 2 drop table t4; delete from t1; delete from t2; delete from t3; insert into t2 values (1); insert into t3 values (1,1); create trigger trg_del before delete on t2 for each row insert into t3 values (bug27417(1), 2); reset master; delete from t2; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 403 select count(*) from t1 /* must be 1 */; count(*) 1 drop trigger trg_del; delete from t1; delete from t2; delete from t5; create trigger trg_del_t2 after delete on t2 for each row insert into t1 values (1); insert into t2 values (2),(3); insert into t5 values (1),(2); reset master; delete t2.* from t2,t5 where t2.a=t5.a + 1; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 429 select count(*) from t1 /* must be 1 */; count(*) 1 delete from t1; create table t4 (a int default 0, b int primary key) engine=innodb; insert into t4 values (0, 17); reset master; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2); ERROR 23000: Duplicate entry '17' for key 'PRIMARY' select * from t4; a b 0 17 select count(*) from t1 /* must be 2 */; count(*) 2 show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 430 drop trigger trg_del_t2; drop table t1,t2,t3,t4,t5; drop function bug27417; end of tests create temporary table tt (a int unique); create table ti (a int) engine=innodb; reset master; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 106 begin; insert into ti values (1); insert into ti values (2) ; insert into tt select * from ti; rollback; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back select count(*) from tt /* 2 */; count(*) 2 show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 395 show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; BEGIN Loading Loading @@ -529,6 +756,7 @@ insert into t2 values (bug27417(1)); ERROR 23000: Duplicate entry '1' for key 'PRIMARY' show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Intvar # # INSERT_ID=1 master-bin.000001 # Query # # use `test`; insert into t2 values (bug27417(1)) master-bin.000001 # Query # # use `test`; ROLLBACK Loading @@ -543,6 +771,7 @@ insert into t2 select bug27417(1) union select bug27417(2); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Intvar # # INSERT_ID=2 master-bin.000001 # Query # # use `test`; insert into t2 select bug27417(1) union select bug27417(2) master-bin.000001 # Query # # use `test`; ROLLBACK Loading Loading @@ -570,6 +799,7 @@ UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Intvar # # INSERT_ID=6 master-bin.000001 # Query # # use `test`; UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */ master-bin.000001 # Query # # use `test`; ROLLBACK Loading Loading @@ -600,6 +830,7 @@ delete from t2; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Intvar # # INSERT_ID=9 master-bin.000001 # Query # # use `test`; delete from t2 master-bin.000001 # Query # # use `test`; ROLLBACK Loading @@ -619,6 +850,7 @@ delete t2.* from t2,t5 where t2.a=t5.a + 1; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Query # # use `test`; delete t2.* from t2,t5 where t2.a=t5.a + 1 master-bin.000001 # Query # # use `test`; ROLLBACK select count(*) from t1 /* must be 1 */; Loading @@ -638,9 +870,12 @@ count(*) 2 show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Intvar # # INSERT_ID=10 master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=12 master-bin.000001 # Intvar # # INSERT_ID=10 master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=1 master-bin.000001 # Query # # use `test`; ROLLBACK drop trigger trg_del_t2; Loading mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result +230 −2 Original line number Diff line number Diff line Loading @@ -389,6 +389,232 @@ select @a like "%#%error_code=0%ROLLBACK\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%" 1 1 drop table t1, t2; create temporary table tt (a int unique); create table ti (a int) engine=innodb; reset master; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 106 begin; insert into ti values (1); insert into ti values (2) ; insert into tt select * from ti; rollback; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back select count(*) from tt /* 2 */; count(*) 2 show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 515 show binlog events from 106; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; BEGIN master-bin.000001 # Query 1 # use `test`; insert into ti values (1) master-bin.000001 # Query 1 # use `test`; insert into ti values (2) master-bin.000001 # Query 1 # use `test`; insert into tt select * from ti master-bin.000001 # Query 1 # use `test`; ROLLBACK select count(*) from ti /* zero */; count(*) 0 insert into ti select * from tt; select * from ti /* that is what slave would miss - a bug */; a 1 2 delete from ti; delete from tt where a=1; reset master; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 106 begin; insert into ti values (1); insert into ti values (2) /* to make the dup error in the following */; insert into tt select * from ti /* one affected and error */; ERROR 23000: Duplicate entry '2' for key 'a' rollback; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 589 show binlog events from 106; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; BEGIN master-bin.000001 # Query 1 # use `test`; insert into ti values (1) master-bin.000001 # Query 1 # use `test`; insert into ti values (2) /* to make the dup error in the following */ master-bin.000001 # Query 1 # use `test`; insert into tt select * from ti /* one affected and error */ master-bin.000001 # Query 1 # use `test`; ROLLBACK select count(*) from ti /* zero */; count(*) 0 insert into ti select * from tt; select * from tt /* that is what otherwise slave missed - the bug */; a 1 2 drop table ti, tt; drop function if exists bug27417; drop table if exists t1,t2; CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM; CREATE TABLE t2 (a int NOT NULL auto_increment, PRIMARY KEY (a)); create function bug27417(n int) RETURNS int(11) begin insert into t1 values (null); return n; end| reset master; insert into t2 values (bug27417(1)); insert into t2 select bug27417(2); reset master; insert into t2 values (bug27417(2)); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 222 /* only (!) with fixes for #23333 will show there is the query */; select count(*) from t1 /* must be 3 */; count(*) 3 reset master; select count(*) from t2; count(*) 2 delete from t2 where a=bug27417(3); select count(*) from t2 /* nothing got deleted */; count(*) 2 show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 227 /* the query must be in regardless of #23333 */; select count(*) from t1 /* must be 5 */; count(*) 5 delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */; affected rows: 0 select count(*) from t1 /* must be 7 */; count(*) 7 drop table t1,t2; CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM; CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique) ENGINE=MyISAM; CREATE TABLE t4 (a int, PRIMARY KEY (a), b int unique) ENGINE=Innodb; CREATE TABLE t5 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; insert into t2 values (1); reset master; insert into t2 values (bug27417(1)); ERROR 23000: Duplicate entry '1' for key 'PRIMARY' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 371 select count(*) from t1 /* must be 1 */; count(*) 1 delete from t1; delete from t2; insert into t2 values (2); reset master; insert into t2 select bug27417(1) union select bug27417(2); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 394 select count(*) from t1 /* must be 2 */; count(*) 2 delete from t1; insert into t3 values (1,1),(2,3),(3,4); reset master; update t3 set b=b+bug27417(1); ERROR 23000: Duplicate entry '4' for key 'b' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 226 select count(*) from t1 /* must be 2 */; count(*) 2 delete from t3; delete from t4; insert into t3 values (1,1); insert into t4 values (1,1),(2,2); reset master; UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 405 select count(*) from t1 /* must be 4 */; count(*) 4 delete from t1; delete from t3; delete from t4; insert into t3 values (1,1),(2,2); insert into t4 values (1,1),(2,2); reset master; UPDATE t3,t4 SET t3.a=t4.a + bug27417(1); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' select count(*) from t1 /* must be 1 */; count(*) 1 drop table t4; delete from t1; delete from t2; delete from t3; insert into t2 values (1); insert into t3 values (1,1); create trigger trg_del before delete on t2 for each row insert into t3 values (bug27417(1), 2); reset master; delete from t2; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 350 select count(*) from t1 /* must be 1 */; count(*) 1 drop trigger trg_del; delete from t1; delete from t2; delete from t5; create trigger trg_del_t2 after delete on t2 for each row insert into t1 values (1); insert into t2 values (2),(3); insert into t5 values (1),(2); reset master; delete t2.* from t2,t5 where t2.a=t5.a + 1; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 350 select count(*) from t1 /* must be 1 */; count(*) 1 delete from t1; create table t4 (a int default 0, b int primary key) engine=innodb; insert into t4 values (0, 17); reset master; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2); ERROR 23000: Duplicate entry '17' for key 'PRIMARY' select * from t4; a b 0 17 select count(*) from t1 /* must be 2 */; count(*) 2 show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 508 drop trigger trg_del_t2; drop table t1,t2,t3,t4,t5; drop function bug27417; end of tests set @@session.binlog_format=statement; create temporary table tt (a int unique); create table ti (a int) engine=innodb; Loading Loading @@ -628,9 +854,11 @@ show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Intvar # # INSERT_ID=10 master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=12 master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci master-bin.000001 # Begin_load_query # # ;file_id=2;block_len=12 master-bin.000001 # Intvar # # INSERT_ID=10 master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=1 master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=2 master-bin.000001 # Query # # use `test`; ROLLBACK drop trigger trg_del_t2; drop table t1,t2,t3,t4,t5; Loading mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam.test +0 −20 Original line number Diff line number Diff line Loading @@ -12,24 +12,4 @@ --enable_ps_protocol # This piece below cannot be put into # extra/binlog_tests/mix_innodb_myisam_binlog.test # because the argument of --start-position differs between statement- # and row-based (and "eval --exec" doesn't work). # we check that the error code of the "ROLLBACK" event is 0 and not # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction # and does not make slave to stop) flush logs; --exec $MYSQL_BINLOG --start-position=524 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output")) is not null; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR eval select @a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%", @a not like "%#%error_code=%error_code=%"; drop table t1, t2; -- source extra/binlog_tests/mix_innodb_myisam_side_effects.test mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test +0 −20 Original line number Diff line number Diff line Loading @@ -4,26 +4,6 @@ -- source include/have_binlog_format_mixed_or_statement.inc -- source extra/binlog_tests/mix_innodb_myisam_binlog.test # This piece below cannot be put into # extra/binlog_tests/mix_innodb_myisam_binlog.test # because the argument of --start-position differs between statement- # and row-based (and "eval --exec" doesn't work). # we check that the error code of the "ROLLBACK" event is 0 and not # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction # and does not make slave to stop) flush logs; --exec $MYSQL_BINLOG --start-position=555 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output")) is not null; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR eval select @a like "%#%error_code=0%ROLLBACK\\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%", @a not like "%#%error_code=%error_code=%"; drop table t1, t2; set @@session.binlog_format=statement; -- source extra/binlog_tests/mix_innodb_myisam_side_effects.test set @@session.binlog_format=@@global.binlog_format; Loading Loading
mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test +14 −4 Original line number Diff line number Diff line Loading @@ -315,11 +315,21 @@ disconnect con3; connection con4; select get_lock("a",10); # wait for rollback to finish flush logs; # we check that the error code of the "ROLLBACK" event is 0 and not # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction # and does not make slave to stop) --exec $MYSQL_BINLOG --start-position=547 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output if (`select @@binlog_format = 'ROW'`) { --exec $MYSQL_BINLOG --start-position=524 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output } if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`) { --exec $MYSQL_BINLOG --start-position=555 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output } --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output")) Loading Loading @@ -360,7 +370,7 @@ rollback; select count(*) from tt /* 2 */; show master status; --replace_column 2 # 5 # show binlog events from 98; show binlog events from 106; select count(*) from ti /* zero */; insert into ti select * from tt; select * from ti /* that is what slave would miss - a bug */; Loading @@ -385,12 +395,12 @@ rollback; show master status; --replace_column 2 # 5 # show binlog events from 98; show binlog events from 106; select count(*) from ti /* zero */; insert into ti select * from tt; select * from tt /* that is what otherwise slave missed - the bug */; drop table ti; drop table ti, tt; # Loading
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result +237 −2 Original line number Diff line number Diff line Loading @@ -113,6 +113,7 @@ insert into t1 values(9); insert into t2 select * from t1; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info 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 # Xid # # COMMIT /* XID */ Loading @@ -126,6 +127,7 @@ begin; insert into t2 select * from t1; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info 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 # Xid # # COMMIT /* XID */ Loading @@ -135,6 +137,7 @@ insert into t1 values(11); commit; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info 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 # Xid # # COMMIT /* XID */ Loading Loading @@ -260,10 +263,12 @@ master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Query # # use `test`; alter table t2 engine=MyISAM 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 # Xid # # COMMIT /* XID */ Loading Loading @@ -366,6 +371,7 @@ master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2 master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb 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`; BEGIN master-bin.000001 # Query # # use `test`; TRUNCATE table t2 master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Table_map # # table_id: # (test.t1) Loading @@ -383,6 +389,7 @@ master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F 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`; BEGIN master-bin.000001 # Query # # use `test`; TRUNCATE table t2 master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Table_map # # table_id: # (test.t1) Loading @@ -408,9 +415,9 @@ is not null; is not null 1 select @a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%", @a like "%#%error_code=0%ROLLBACK\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%", @a not like "%#%error_code=%error_code=%"; @a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%" @a like "%#%error_code=0%ROLLBACK\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%" 1 1 drop table t1, t2; create temporary table tt (a int unique); Loading @@ -432,6 +439,226 @@ count(*) show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 395 show binlog events from 106; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; BEGIN master-bin.000001 # Table_map 1 # table_id: 27 (test.ti) master-bin.000001 # Write_rows 1 # table_id: 27 flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: 27 (test.ti) master-bin.000001 # Write_rows 1 # table_id: 27 flags: STMT_END_F master-bin.000001 # Query 1 # use `test`; ROLLBACK select count(*) from ti /* zero */; count(*) 0 insert into ti select * from tt; select * from ti /* that is what slave would miss - a bug */; a 1 2 delete from ti; delete from tt where a=1; reset master; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 106 begin; insert into ti values (1); insert into ti values (2) /* to make the dup error in the following */; insert into tt select * from ti /* one affected and error */; ERROR 23000: Duplicate entry '2' for key 'a' rollback; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 106 show binlog events from 106; Log_name Pos Event_type Server_id End_log_pos Info select count(*) from ti /* zero */; count(*) 0 insert into ti select * from tt; select * from tt /* that is what otherwise slave missed - the bug */; a 1 2 drop table ti, tt; drop function if exists bug27417; drop table if exists t1,t2; CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM; CREATE TABLE t2 (a int NOT NULL auto_increment, PRIMARY KEY (a)); create function bug27417(n int) RETURNS int(11) begin insert into t1 values (null); return n; end| reset master; insert into t2 values (bug27417(1)); insert into t2 select bug27417(2); reset master; insert into t2 values (bug27417(2)); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 222 /* only (!) with fixes for #23333 will show there is the query */; select count(*) from t1 /* must be 3 */; count(*) 3 reset master; select count(*) from t2; count(*) 2 delete from t2 where a=bug27417(3); select count(*) from t2 /* nothing got deleted */; count(*) 2 show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 227 /* the query must be in regardless of #23333 */; select count(*) from t1 /* must be 5 */; count(*) 5 delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */; affected rows: 0 select count(*) from t1 /* must be 7 */; count(*) 7 drop table t1,t2; CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM; CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique) ENGINE=MyISAM; CREATE TABLE t4 (a int, PRIMARY KEY (a), b int unique) ENGINE=Innodb; CREATE TABLE t5 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; insert into t2 values (1); reset master; insert into t2 values (bug27417(1)); ERROR 23000: Duplicate entry '1' for key 'PRIMARY' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 361 select count(*) from t1 /* must be 1 */; count(*) 1 delete from t1; delete from t2; insert into t2 values (2); reset master; insert into t2 select bug27417(1) union select bug27417(2); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 400 select count(*) from t1 /* must be 2 */; count(*) 2 delete from t1; insert into t3 values (1,1),(2,3),(3,4); reset master; update t3 set b=b+bug27417(1); ERROR 23000: Duplicate entry '4' for key 'b' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 305 select count(*) from t1 /* must be 2 */; count(*) 2 delete from t3; delete from t4; insert into t3 values (1,1); insert into t4 values (1,1),(2,2); reset master; UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 367 select count(*) from t1 /* must be 4 */; count(*) 4 delete from t1; delete from t3; delete from t4; insert into t3 values (1,1),(2,2); insert into t4 values (1,1),(2,2); reset master; UPDATE t3,t4 SET t3.a=t4.a + bug27417(1); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' select count(*) from t1 /* must be 1 */; count(*) 2 drop table t4; delete from t1; delete from t2; delete from t3; insert into t2 values (1); insert into t3 values (1,1); create trigger trg_del before delete on t2 for each row insert into t3 values (bug27417(1), 2); reset master; delete from t2; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 403 select count(*) from t1 /* must be 1 */; count(*) 1 drop trigger trg_del; delete from t1; delete from t2; delete from t5; create trigger trg_del_t2 after delete on t2 for each row insert into t1 values (1); insert into t2 values (2),(3); insert into t5 values (1),(2); reset master; delete t2.* from t2,t5 where t2.a=t5.a + 1; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 429 select count(*) from t1 /* must be 1 */; count(*) 1 delete from t1; create table t4 (a int default 0, b int primary key) engine=innodb; insert into t4 values (0, 17); reset master; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2); ERROR 23000: Duplicate entry '17' for key 'PRIMARY' select * from t4; a b 0 17 select count(*) from t1 /* must be 2 */; count(*) 2 show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 430 drop trigger trg_del_t2; drop table t1,t2,t3,t4,t5; drop function bug27417; end of tests create temporary table tt (a int unique); create table ti (a int) engine=innodb; reset master; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 106 begin; insert into ti values (1); insert into ti values (2) ; insert into tt select * from ti; rollback; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back select count(*) from tt /* 2 */; count(*) 2 show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 395 show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; BEGIN Loading Loading @@ -529,6 +756,7 @@ insert into t2 values (bug27417(1)); ERROR 23000: Duplicate entry '1' for key 'PRIMARY' show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Intvar # # INSERT_ID=1 master-bin.000001 # Query # # use `test`; insert into t2 values (bug27417(1)) master-bin.000001 # Query # # use `test`; ROLLBACK Loading @@ -543,6 +771,7 @@ insert into t2 select bug27417(1) union select bug27417(2); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Intvar # # INSERT_ID=2 master-bin.000001 # Query # # use `test`; insert into t2 select bug27417(1) union select bug27417(2) master-bin.000001 # Query # # use `test`; ROLLBACK Loading Loading @@ -570,6 +799,7 @@ UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Intvar # # INSERT_ID=6 master-bin.000001 # Query # # use `test`; UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */ master-bin.000001 # Query # # use `test`; ROLLBACK Loading Loading @@ -600,6 +830,7 @@ delete from t2; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Intvar # # INSERT_ID=9 master-bin.000001 # Query # # use `test`; delete from t2 master-bin.000001 # Query # # use `test`; ROLLBACK Loading @@ -619,6 +850,7 @@ delete t2.* from t2,t5 where t2.a=t5.a + 1; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Query # # use `test`; delete t2.* from t2,t5 where t2.a=t5.a + 1 master-bin.000001 # Query # # use `test`; ROLLBACK select count(*) from t1 /* must be 1 */; Loading @@ -638,9 +870,12 @@ count(*) 2 show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Intvar # # INSERT_ID=10 master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=12 master-bin.000001 # Intvar # # INSERT_ID=10 master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=1 master-bin.000001 # Query # # use `test`; ROLLBACK drop trigger trg_del_t2; Loading
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result +230 −2 Original line number Diff line number Diff line Loading @@ -389,6 +389,232 @@ select @a like "%#%error_code=0%ROLLBACK\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%" 1 1 drop table t1, t2; create temporary table tt (a int unique); create table ti (a int) engine=innodb; reset master; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 106 begin; insert into ti values (1); insert into ti values (2) ; insert into tt select * from ti; rollback; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back select count(*) from tt /* 2 */; count(*) 2 show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 515 show binlog events from 106; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; BEGIN master-bin.000001 # Query 1 # use `test`; insert into ti values (1) master-bin.000001 # Query 1 # use `test`; insert into ti values (2) master-bin.000001 # Query 1 # use `test`; insert into tt select * from ti master-bin.000001 # Query 1 # use `test`; ROLLBACK select count(*) from ti /* zero */; count(*) 0 insert into ti select * from tt; select * from ti /* that is what slave would miss - a bug */; a 1 2 delete from ti; delete from tt where a=1; reset master; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 106 begin; insert into ti values (1); insert into ti values (2) /* to make the dup error in the following */; insert into tt select * from ti /* one affected and error */; ERROR 23000: Duplicate entry '2' for key 'a' rollback; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 589 show binlog events from 106; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; BEGIN master-bin.000001 # Query 1 # use `test`; insert into ti values (1) master-bin.000001 # Query 1 # use `test`; insert into ti values (2) /* to make the dup error in the following */ master-bin.000001 # Query 1 # use `test`; insert into tt select * from ti /* one affected and error */ master-bin.000001 # Query 1 # use `test`; ROLLBACK select count(*) from ti /* zero */; count(*) 0 insert into ti select * from tt; select * from tt /* that is what otherwise slave missed - the bug */; a 1 2 drop table ti, tt; drop function if exists bug27417; drop table if exists t1,t2; CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM; CREATE TABLE t2 (a int NOT NULL auto_increment, PRIMARY KEY (a)); create function bug27417(n int) RETURNS int(11) begin insert into t1 values (null); return n; end| reset master; insert into t2 values (bug27417(1)); insert into t2 select bug27417(2); reset master; insert into t2 values (bug27417(2)); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 222 /* only (!) with fixes for #23333 will show there is the query */; select count(*) from t1 /* must be 3 */; count(*) 3 reset master; select count(*) from t2; count(*) 2 delete from t2 where a=bug27417(3); select count(*) from t2 /* nothing got deleted */; count(*) 2 show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 227 /* the query must be in regardless of #23333 */; select count(*) from t1 /* must be 5 */; count(*) 5 delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */; affected rows: 0 select count(*) from t1 /* must be 7 */; count(*) 7 drop table t1,t2; CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM; CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique) ENGINE=MyISAM; CREATE TABLE t4 (a int, PRIMARY KEY (a), b int unique) ENGINE=Innodb; CREATE TABLE t5 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; insert into t2 values (1); reset master; insert into t2 values (bug27417(1)); ERROR 23000: Duplicate entry '1' for key 'PRIMARY' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 371 select count(*) from t1 /* must be 1 */; count(*) 1 delete from t1; delete from t2; insert into t2 values (2); reset master; insert into t2 select bug27417(1) union select bug27417(2); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 394 select count(*) from t1 /* must be 2 */; count(*) 2 delete from t1; insert into t3 values (1,1),(2,3),(3,4); reset master; update t3 set b=b+bug27417(1); ERROR 23000: Duplicate entry '4' for key 'b' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 226 select count(*) from t1 /* must be 2 */; count(*) 2 delete from t3; delete from t4; insert into t3 values (1,1); insert into t4 values (1,1),(2,2); reset master; UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 405 select count(*) from t1 /* must be 4 */; count(*) 4 delete from t1; delete from t3; delete from t4; insert into t3 values (1,1),(2,2); insert into t4 values (1,1),(2,2); reset master; UPDATE t3,t4 SET t3.a=t4.a + bug27417(1); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' select count(*) from t1 /* must be 1 */; count(*) 1 drop table t4; delete from t1; delete from t2; delete from t3; insert into t2 values (1); insert into t3 values (1,1); create trigger trg_del before delete on t2 for each row insert into t3 values (bug27417(1), 2); reset master; delete from t2; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 350 select count(*) from t1 /* must be 1 */; count(*) 1 drop trigger trg_del; delete from t1; delete from t2; delete from t5; create trigger trg_del_t2 after delete on t2 for each row insert into t1 values (1); insert into t2 values (2),(3); insert into t5 values (1),(2); reset master; delete t2.* from t2,t5 where t2.a=t5.a + 1; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 350 select count(*) from t1 /* must be 1 */; count(*) 1 delete from t1; create table t4 (a int default 0, b int primary key) engine=innodb; insert into t4 values (0, 17); reset master; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2); ERROR 23000: Duplicate entry '17' for key 'PRIMARY' select * from t4; a b 0 17 select count(*) from t1 /* must be 2 */; count(*) 2 show master status /* the offset must denote there is the query */; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 508 drop trigger trg_del_t2; drop table t1,t2,t3,t4,t5; drop function bug27417; end of tests set @@session.binlog_format=statement; create temporary table tt (a int unique); create table ti (a int) engine=innodb; Loading Loading @@ -628,9 +854,11 @@ show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Intvar # # INSERT_ID=10 master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=12 master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci master-bin.000001 # Begin_load_query # # ;file_id=2;block_len=12 master-bin.000001 # Intvar # # INSERT_ID=10 master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=1 master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=2 master-bin.000001 # Query # # use `test`; ROLLBACK drop trigger trg_del_t2; drop table t1,t2,t3,t4,t5; Loading
mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam.test +0 −20 Original line number Diff line number Diff line Loading @@ -12,24 +12,4 @@ --enable_ps_protocol # This piece below cannot be put into # extra/binlog_tests/mix_innodb_myisam_binlog.test # because the argument of --start-position differs between statement- # and row-based (and "eval --exec" doesn't work). # we check that the error code of the "ROLLBACK" event is 0 and not # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction # and does not make slave to stop) flush logs; --exec $MYSQL_BINLOG --start-position=524 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output")) is not null; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR eval select @a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%", @a not like "%#%error_code=%error_code=%"; drop table t1, t2; -- source extra/binlog_tests/mix_innodb_myisam_side_effects.test
mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test +0 −20 Original line number Diff line number Diff line Loading @@ -4,26 +4,6 @@ -- source include/have_binlog_format_mixed_or_statement.inc -- source extra/binlog_tests/mix_innodb_myisam_binlog.test # This piece below cannot be put into # extra/binlog_tests/mix_innodb_myisam_binlog.test # because the argument of --start-position differs between statement- # and row-based (and "eval --exec" doesn't work). # we check that the error code of the "ROLLBACK" event is 0 and not # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction # and does not make slave to stop) flush logs; --exec $MYSQL_BINLOG --start-position=555 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output")) is not null; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR eval select @a like "%#%error_code=0%ROLLBACK\\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%", @a not like "%#%error_code=%error_code=%"; drop table t1, t2; set @@session.binlog_format=statement; -- source extra/binlog_tests/mix_innodb_myisam_side_effects.test set @@session.binlog_format=@@global.binlog_format; Loading