Loading mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test +315 −0 Original line number Diff line number Diff line Loading @@ -316,3 +316,318 @@ disconnect con3; connection con4; select get_lock("a",10); # wait for rollback to finish # 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 --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; # # Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack # bug #28960 non-trans temp table changes with insert .. select # not binlogged after rollback # # testing appearence of insert into temp_table in binlog. # There are two branches of execution that require different setup. ## send_eof() branch # prepare create temporary table tt (a int unique); create table ti (a int) engine=innodb; reset master; show master status; # action begin; insert into ti values (1); insert into ti values (2) ; insert into tt select * from ti; rollback; # check select count(*) from tt /* 2 */; show master status; --replace_column 2 # 5 # show binlog events from 98; select count(*) from ti /* zero */; insert into ti select * from tt; select * from ti /* that is what slave would miss - a bug */; ## send_error() branch delete from ti; delete from tt where a=1; reset master; show master status; # action begin; insert into ti values (1); insert into ti values (2) /* to make the dup error in the following */; --error ER_DUP_ENTRY insert into tt select * from ti /* one affected and error */; rollback; # check show master status; --replace_column 2 # 5 # show binlog events from 98; 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; # # Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack # # Testing asserts: if there is a side effect of modifying non-transactional # table thd->no_trans_update.stmt must be TRUE; # the assert is active with debug build # --disable_warnings drop function if exists bug27417; drop table if exists t1,t2; --enable_warnings # side effect table CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM; # target tables CREATE TABLE t2 (a int NOT NULL auto_increment, PRIMARY KEY (a)); delimiter |; create function bug27417(n int) RETURNS int(11) begin insert into t1 values (null); return n; end| delimiter ;| reset master; # execute insert into t2 values (bug27417(1)); insert into t2 select bug27417(2); reset master; --error ER_DUP_ENTRY insert into t2 values (bug27417(2)); show master status; /* only (!) with fixes for #23333 will show there is the query */; select count(*) from t1 /* must be 3 */; reset master; select count(*) from t2; delete from t2 where a=bug27417(3); select count(*) from t2 /* nothing got deleted */; show master status; /* the query must be in regardless of #23333 */; select count(*) from t1 /* must be 5 */; --enable_info delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */; --disable_info select count(*) from t1 /* must be 7 */; # function bug27417 remains for the following testing of bug#23333 drop table t1,t2; # # Bug#23333 using the patch (and the test) for bug#27471 # # throughout the bug tests # t1 - non-trans side effects gatherer; # t2 - transactional table; # 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 # # prepare insert into t2 values (1); reset master; # execute --error ER_DUP_ENTRY insert into t2 values (bug27417(1)); # check show master status /* the offset must denote there is the query */; select count(*) from t1 /* must be 1 */; # # INSERT SELECT # # prepare delete from t1; delete from t2; insert into t2 values (2); reset master; # execute --error ER_DUP_ENTRY insert into t2 select bug27417(1) union select bug27417(2); # check show master status /* the offset must denote there is the query */; select count(*) from t1 /* must be 2 */; # # UPDATE inc multi-update # # prepare delete from t1; insert into t3 values (1,1),(2,3),(3,4); reset master; # execute --error ER_DUP_ENTRY update t3 set b=b+bug27417(1); # check show master status /* the offset must denote there is the query */; select count(*) from t1 /* must be 2 */; ## multi_update::send_eof() branch # prepare delete from t3; delete from t4; insert into t3 values (1,1); insert into t4 values (1,1),(2,2); reset master; # execute --error ER_DUP_ENTRY UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */; # check show master status /* the offset must denote there is the query */; select count(*) from t1 /* must be 4 */; ## send_error() branch of multi_update # prepare 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; # execute --error ER_DUP_ENTRY UPDATE t3,t4 SET t3.a=t4.a + bug27417(1); # check select count(*) from t1 /* must be 1 */; # cleanup drop table t4; # # DELETE incl multi-delete # # prepare 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; # execute --error ER_DUP_ENTRY delete from t2; # check show master status /* the offset must denote there is the query */; select count(*) from t1 /* must be 1 */; # cleanup drop trigger trg_del; # prepare 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; # execute --error ER_DUP_ENTRY delete t2.* from t2,t5 where t2.a=t5.a + 1; # check show master status /* the offset must denote there is the query */; select count(*) from t1 /* must be 1 */; # # LOAD DATA # # prepare delete from t1; create table t4 (a int default 0, b int primary key) engine=innodb; insert into t4 values (0, 17); reset master; # execute --error ER_DUP_ENTRY load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2); # check select * from t4; select count(*) from t1 /* must be 2 */; show master status /* the offset must denote there is the query */; # # bug#23333 cleanup # drop trigger trg_del_t2; drop table t1,t2,t3,t4,t5; drop function bug27417; --echo end of tests mysql-test/r/binlog_start_comment.result 0 → 100644 +13 −0 Original line number Diff line number Diff line drop table if exists t1,t2; create table t1 (word varchar(20)) -- create table t1; create table t2 (word varchar(20)) -- create table t2; load data infile '../std_data_ln/words.dat' into table t1 -- load data to t1; insert into t2 values ("Ada"); flush logs; select * from t2; word Ada flush logs; select * from t2; word Ada mysql-test/r/mysqlbinlog.result +72 −36 Original line number Diff line number Diff line Loading @@ -23,24 +23,33 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; drop table if exists t1,t2,t3,t4,t5,t03,t04/*!*/; drop table if exists t1,t2,t3,t4,t5,t03,t04 /*!*/; SET TIMESTAMP=1000000000/*!*/; create table t1 (word varchar(20))/*!*/; create table t1 (word varchar(20)) /*!*/; SET TIMESTAMP=1000000000/*!*/; create table t2 (id int auto_increment not null primary key)/*!*/; create table t2 (id int auto_increment not null primary key) /*!*/; SET TIMESTAMP=1000000000/*!*/; insert into t1 values ("abirvalg")/*!*/; insert into t1 values ("abirvalg") /*!*/; SET INSERT_ID=1/*!*/; SET TIMESTAMP=1000000000/*!*/; insert into t2 values ()/*!*/; insert into t2 values () /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-1-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-1-0' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-2-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-2-0' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-3-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-3-0' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-4-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-4-0' INTO table t1 /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading @@ -56,7 +65,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; insert into t1 values ("Alas")/*!*/; insert into t1 values ("Alas") /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading @@ -83,7 +93,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; insert into t1 values ("Alas")/*!*/; insert into t1 values ("Alas") /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading @@ -100,24 +111,33 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; drop table if exists t1,t2,t3,t4,t5,t03,t04/*!*/; drop table if exists t1,t2,t3,t4,t5,t03,t04 /*!*/; SET TIMESTAMP=1000000000/*!*/; create table t1 (word varchar(20))/*!*/; create table t1 (word varchar(20)) /*!*/; SET TIMESTAMP=1000000000/*!*/; create table t2 (id int auto_increment not null primary key)/*!*/; create table t2 (id int auto_increment not null primary key) /*!*/; SET TIMESTAMP=1000000000/*!*/; insert into t1 values ("abirvalg")/*!*/; insert into t1 values ("abirvalg") /*!*/; SET INSERT_ID=1/*!*/; SET TIMESTAMP=1000000000/*!*/; insert into t2 values ()/*!*/; insert into t2 values () /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-1-2' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-1-2' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-2-2' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-2-2' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-3-2' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-3-2' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-4-2' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-4-2' INTO table t1 /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading @@ -133,7 +153,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; insert into t1 values ("Alas")/*!*/; insert into t1 values ("Alas") /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading @@ -160,7 +181,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; insert into t1 values ("Alas")/*!*/; insert into t1 values ("Alas") /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading @@ -173,9 +195,11 @@ DELIMITER /*!*/; ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1108844556/*!*/; BEGIN/*!*/; BEGIN /*!*/; SET TIMESTAMP=1108844555/*!*/; insert t1 values (1)/*!*/; insert t1 values (1) /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading @@ -185,9 +209,11 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; use test/*!*/; SET TIMESTAMP=1108844556/*!*/; BEGIN/*!*/; BEGIN /*!*/; SET TIMESTAMP=1108844555/*!*/; insert t1 values (1)/*!*/; insert t1 values (1) /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading Loading @@ -246,7 +272,8 @@ SET @@session.character_set_client=8,@@session.collation_connection=8,@@session. CREATE DEFINER=`root`@`localhost` procedure p1() begin select 1; end/*!*/; end /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading Loading @@ -288,27 +315,36 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; create table t1 (a varchar(64) character set utf8)/*!*/; create table t1 (a varchar(64) character set utf8) /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-6-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-6-0' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.collation_database=7/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-7-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-7-0' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.collation_database=DEFAULT/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-8-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-8-0' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-9-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-9-0' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.collation_database=7/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.collation_database=DEFAULT/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO table t1 character set koi8r/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO table t1 character set koi8r /*!*/; SET TIMESTAMP=1000000000/*!*/; drop table t1/*!*/; drop table t1 /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading mysql-test/r/user_var-binlog.result +4 −2 Original line number Diff line number Diff line Loading @@ -25,11 +25,13 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; INSERT INTO t1 VALUES(@`a b`)/*!*/; INSERT INTO t1 VALUES(@`a b`) /*!*/; SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`/*!*/; SET @`var2`:=_binary 0x61 COLLATE `binary`/*!*/; SET TIMESTAMP=10000/*!*/; insert into t1 values (@var1),(@var2)/*!*/; insert into t1 values (@var1),(@var2) /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result +2 −2 Original line number Diff line number Diff line Loading @@ -384,9 +384,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; set @@session.binlog_format=statement; Loading Loading
mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test +315 −0 Original line number Diff line number Diff line Loading @@ -316,3 +316,318 @@ disconnect con3; connection con4; select get_lock("a",10); # wait for rollback to finish # 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 --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; # # Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack # bug #28960 non-trans temp table changes with insert .. select # not binlogged after rollback # # testing appearence of insert into temp_table in binlog. # There are two branches of execution that require different setup. ## send_eof() branch # prepare create temporary table tt (a int unique); create table ti (a int) engine=innodb; reset master; show master status; # action begin; insert into ti values (1); insert into ti values (2) ; insert into tt select * from ti; rollback; # check select count(*) from tt /* 2 */; show master status; --replace_column 2 # 5 # show binlog events from 98; select count(*) from ti /* zero */; insert into ti select * from tt; select * from ti /* that is what slave would miss - a bug */; ## send_error() branch delete from ti; delete from tt where a=1; reset master; show master status; # action begin; insert into ti values (1); insert into ti values (2) /* to make the dup error in the following */; --error ER_DUP_ENTRY insert into tt select * from ti /* one affected and error */; rollback; # check show master status; --replace_column 2 # 5 # show binlog events from 98; 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; # # Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack # # Testing asserts: if there is a side effect of modifying non-transactional # table thd->no_trans_update.stmt must be TRUE; # the assert is active with debug build # --disable_warnings drop function if exists bug27417; drop table if exists t1,t2; --enable_warnings # side effect table CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM; # target tables CREATE TABLE t2 (a int NOT NULL auto_increment, PRIMARY KEY (a)); delimiter |; create function bug27417(n int) RETURNS int(11) begin insert into t1 values (null); return n; end| delimiter ;| reset master; # execute insert into t2 values (bug27417(1)); insert into t2 select bug27417(2); reset master; --error ER_DUP_ENTRY insert into t2 values (bug27417(2)); show master status; /* only (!) with fixes for #23333 will show there is the query */; select count(*) from t1 /* must be 3 */; reset master; select count(*) from t2; delete from t2 where a=bug27417(3); select count(*) from t2 /* nothing got deleted */; show master status; /* the query must be in regardless of #23333 */; select count(*) from t1 /* must be 5 */; --enable_info delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */; --disable_info select count(*) from t1 /* must be 7 */; # function bug27417 remains for the following testing of bug#23333 drop table t1,t2; # # Bug#23333 using the patch (and the test) for bug#27471 # # throughout the bug tests # t1 - non-trans side effects gatherer; # t2 - transactional table; # 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 # # prepare insert into t2 values (1); reset master; # execute --error ER_DUP_ENTRY insert into t2 values (bug27417(1)); # check show master status /* the offset must denote there is the query */; select count(*) from t1 /* must be 1 */; # # INSERT SELECT # # prepare delete from t1; delete from t2; insert into t2 values (2); reset master; # execute --error ER_DUP_ENTRY insert into t2 select bug27417(1) union select bug27417(2); # check show master status /* the offset must denote there is the query */; select count(*) from t1 /* must be 2 */; # # UPDATE inc multi-update # # prepare delete from t1; insert into t3 values (1,1),(2,3),(3,4); reset master; # execute --error ER_DUP_ENTRY update t3 set b=b+bug27417(1); # check show master status /* the offset must denote there is the query */; select count(*) from t1 /* must be 2 */; ## multi_update::send_eof() branch # prepare delete from t3; delete from t4; insert into t3 values (1,1); insert into t4 values (1,1),(2,2); reset master; # execute --error ER_DUP_ENTRY UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */; # check show master status /* the offset must denote there is the query */; select count(*) from t1 /* must be 4 */; ## send_error() branch of multi_update # prepare 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; # execute --error ER_DUP_ENTRY UPDATE t3,t4 SET t3.a=t4.a + bug27417(1); # check select count(*) from t1 /* must be 1 */; # cleanup drop table t4; # # DELETE incl multi-delete # # prepare 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; # execute --error ER_DUP_ENTRY delete from t2; # check show master status /* the offset must denote there is the query */; select count(*) from t1 /* must be 1 */; # cleanup drop trigger trg_del; # prepare 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; # execute --error ER_DUP_ENTRY delete t2.* from t2,t5 where t2.a=t5.a + 1; # check show master status /* the offset must denote there is the query */; select count(*) from t1 /* must be 1 */; # # LOAD DATA # # prepare delete from t1; create table t4 (a int default 0, b int primary key) engine=innodb; insert into t4 values (0, 17); reset master; # execute --error ER_DUP_ENTRY load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2); # check select * from t4; select count(*) from t1 /* must be 2 */; show master status /* the offset must denote there is the query */; # # bug#23333 cleanup # drop trigger trg_del_t2; drop table t1,t2,t3,t4,t5; drop function bug27417; --echo end of tests
mysql-test/r/binlog_start_comment.result 0 → 100644 +13 −0 Original line number Diff line number Diff line drop table if exists t1,t2; create table t1 (word varchar(20)) -- create table t1; create table t2 (word varchar(20)) -- create table t2; load data infile '../std_data_ln/words.dat' into table t1 -- load data to t1; insert into t2 values ("Ada"); flush logs; select * from t2; word Ada flush logs; select * from t2; word Ada
mysql-test/r/mysqlbinlog.result +72 −36 Original line number Diff line number Diff line Loading @@ -23,24 +23,33 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; drop table if exists t1,t2,t3,t4,t5,t03,t04/*!*/; drop table if exists t1,t2,t3,t4,t5,t03,t04 /*!*/; SET TIMESTAMP=1000000000/*!*/; create table t1 (word varchar(20))/*!*/; create table t1 (word varchar(20)) /*!*/; SET TIMESTAMP=1000000000/*!*/; create table t2 (id int auto_increment not null primary key)/*!*/; create table t2 (id int auto_increment not null primary key) /*!*/; SET TIMESTAMP=1000000000/*!*/; insert into t1 values ("abirvalg")/*!*/; insert into t1 values ("abirvalg") /*!*/; SET INSERT_ID=1/*!*/; SET TIMESTAMP=1000000000/*!*/; insert into t2 values ()/*!*/; insert into t2 values () /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-1-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-1-0' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-2-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-2-0' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-3-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-3-0' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-4-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-4-0' INTO table t1 /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading @@ -56,7 +65,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; insert into t1 values ("Alas")/*!*/; insert into t1 values ("Alas") /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading @@ -83,7 +93,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; insert into t1 values ("Alas")/*!*/; insert into t1 values ("Alas") /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading @@ -100,24 +111,33 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; drop table if exists t1,t2,t3,t4,t5,t03,t04/*!*/; drop table if exists t1,t2,t3,t4,t5,t03,t04 /*!*/; SET TIMESTAMP=1000000000/*!*/; create table t1 (word varchar(20))/*!*/; create table t1 (word varchar(20)) /*!*/; SET TIMESTAMP=1000000000/*!*/; create table t2 (id int auto_increment not null primary key)/*!*/; create table t2 (id int auto_increment not null primary key) /*!*/; SET TIMESTAMP=1000000000/*!*/; insert into t1 values ("abirvalg")/*!*/; insert into t1 values ("abirvalg") /*!*/; SET INSERT_ID=1/*!*/; SET TIMESTAMP=1000000000/*!*/; insert into t2 values ()/*!*/; insert into t2 values () /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-1-2' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-1-2' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-2-2' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-2-2' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-3-2' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-3-2' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-4-2' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-4-2' INTO table t1 /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading @@ -133,7 +153,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; insert into t1 values ("Alas")/*!*/; insert into t1 values ("Alas") /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading @@ -160,7 +181,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; insert into t1 values ("Alas")/*!*/; insert into t1 values ("Alas") /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading @@ -173,9 +195,11 @@ DELIMITER /*!*/; ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1108844556/*!*/; BEGIN/*!*/; BEGIN /*!*/; SET TIMESTAMP=1108844555/*!*/; insert t1 values (1)/*!*/; insert t1 values (1) /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading @@ -185,9 +209,11 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; use test/*!*/; SET TIMESTAMP=1108844556/*!*/; BEGIN/*!*/; BEGIN /*!*/; SET TIMESTAMP=1108844555/*!*/; insert t1 values (1)/*!*/; insert t1 values (1) /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading Loading @@ -246,7 +272,8 @@ SET @@session.character_set_client=8,@@session.collation_connection=8,@@session. CREATE DEFINER=`root`@`localhost` procedure p1() begin select 1; end/*!*/; end /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading Loading @@ -288,27 +315,36 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; create table t1 (a varchar(64) character set utf8)/*!*/; create table t1 (a varchar(64) character set utf8) /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-6-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-6-0' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.collation_database=7/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-7-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-7-0' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.collation_database=DEFAULT/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-8-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-8-0' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-9-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-9-0' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.collation_database=7/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.collation_database=DEFAULT/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO table t1 character set koi8r/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO table t1 character set koi8r /*!*/; SET TIMESTAMP=1000000000/*!*/; drop table t1/*!*/; drop table t1 /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading
mysql-test/r/user_var-binlog.result +4 −2 Original line number Diff line number Diff line Loading @@ -25,11 +25,13 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; INSERT INTO t1 VALUES(@`a b`)/*!*/; INSERT INTO t1 VALUES(@`a b`) /*!*/; SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`/*!*/; SET @`var2`:=_binary 0x61 COLLATE `binary`/*!*/; SET TIMESTAMP=10000/*!*/; insert into t1 values (@var1),(@var2)/*!*/; insert into t1 values (@var1),(@var2) /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; Loading
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result +2 −2 Original line number Diff line number Diff line Loading @@ -384,9 +384,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; set @@session.binlog_format=statement; Loading