Commit 68297025 authored by unknown's avatar unknown

Manual merge fixes/tests for bugs_28960,27417,23333.


mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test:
  follow-up of the previous manual resolve. The snippet is moved into the heading
  file.
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
  results changed
mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test:
  removing explicit offsets from report;
  appending bug#27417,23333,28960 related snippet, addressing left TODO:s.
mysql-test/suite/rpl/r/rpl_packet.result:
  results changed
mysql-test/suite/rpl/t/rpl_packet.test:
  fixing row/stmt compatibility with #-ing out unneeded values
parent e35c1ab9
...@@ -316,253 +316,3 @@ disconnect con3; ...@@ -316,253 +316,3 @@ disconnect con3;
connection con4; connection con4;
select get_lock("a",10); # wait for rollback to finish 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/*!*/;%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);
#
# 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 (multi-update see bug#27716)
#
# 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 */;
#
# DELETE (for multi-delete see Bug #29136)
#
# 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 */;
#
# 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;
drop table t1,t2,t3,t4;
drop function bug27417;
--echo end of tests
...@@ -380,7 +380,7 @@ select ...@@ -380,7 +380,7 @@ select
@a like "%#%error_code=0%ROLLBACK/*!*/;%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=%"
1 1 1 1
drop table t1, t2; drop table t1, t2;
create table tt (a int unique); create temporary table tt (a int unique);
create table ti (a int) engine=innodb; create table ti (a int) engine=innodb;
reset master; reset master;
show master status; show master status;
...@@ -399,18 +399,18 @@ count(*) ...@@ -399,18 +399,18 @@ count(*)
show master status; show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 515 master-bin.000001 515
show binlog events from 106; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; BEGIN master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Query 1 # use `test`; insert into ti values (1) master-bin.000001 # Query # # use `test`; insert into ti values (1)
master-bin.000001 # Query 1 # use `test`; insert into ti values (2) master-bin.000001 # Query # # use `test`; insert into ti values (2)
master-bin.000001 # Query 1 # use `test`; insert into tt select * from ti master-bin.000001 # Query # # use `test`; insert into tt select * from ti
master-bin.000001 # Query 1 # use `test`; ROLLBACK master-bin.000001 # Query # # use `test`; ROLLBACK
select count(*) from ti /* zero */; select count(*) from ti /* zero */;
count(*) count(*)
0 0
insert into ti select * from tt; insert into ti select * from tt;
select * from ti /* that is what slave would miss - a bug */; select * from ti /* that is what slave would miss - bug#28960 */;
a a
1 1
2 2
...@@ -426,18 +426,11 @@ insert into ti values (2) /* to make the dup error in the following */; ...@@ -426,18 +426,11 @@ insert into ti values (2) /* to make the dup error in the following */;
insert into tt select * from ti /* one affected and error */; insert into tt select * from ti /* one affected and error */;
ERROR 23000: Duplicate entry '2' for key 'a' ERROR 23000: Duplicate entry '2' for key 'a'
rollback; rollback;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
show master status; show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 589 master-bin.000001 106
show binlog events from 106; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info 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 */; select count(*) from ti /* zero */;
count(*) count(*)
0 0
...@@ -446,7 +439,7 @@ select * from tt /* that is what otherwise slave missed - the bug */; ...@@ -446,7 +439,7 @@ select * from tt /* that is what otherwise slave missed - the bug */;
a a
1 1
2 2
drop table ti,tt; drop table ti;
drop function if exists bug27417; drop function if exists bug27417;
drop table if exists t1,t2; drop table if exists t1,t2;
CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM; CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM;
...@@ -463,6 +456,10 @@ insert into t2 select bug27417(2); ...@@ -463,6 +456,10 @@ insert into t2 select bug27417(2);
reset master; reset master;
insert into t2 values (bug27417(2)); insert into t2 values (bug27417(2));
ERROR 23000: Duplicate entry '2' for key 'PRIMARY' 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 */; select count(*) from t1 /* must be 3 */;
count(*) count(*)
3 3
...@@ -474,6 +471,10 @@ delete from t2 where a=bug27417(3); ...@@ -474,6 +471,10 @@ delete from t2 where a=bug27417(3);
select count(*) from t2 /* nothing got deleted */; select count(*) from t2 /* nothing got deleted */;
count(*) count(*)
2 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 */; select count(*) from t1 /* must be 5 */;
count(*) count(*)
5 5
...@@ -482,6 +483,75 @@ affected rows: 0 ...@@ -482,6 +483,75 @@ affected rows: 0
select count(*) from t1 /* must be 7 */; select count(*) from t1 /* must be 7 */;
count(*) count(*)
7 7
drop function bug27417;
drop table t1,t2; 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);
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 293
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 332
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 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 335
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 362
drop trigger trg_del;
drop table t1,t2,t3,t4;
drop function bug27417;
end of tests end of tests
...@@ -36,7 +36,7 @@ drop table t1, t2; ...@@ -36,7 +36,7 @@ drop table t1, t2;
# prepare # prepare
create table tt (a int unique); create temporary table tt (a int unique);
create table ti (a int) engine=innodb; create table ti (a int) engine=innodb;
reset master; reset master;
show master status; show master status;
...@@ -53,11 +53,10 @@ rollback; ...@@ -53,11 +53,10 @@ rollback;
select count(*) from tt /* 2 */; select count(*) from tt /* 2 */;
show master status; show master status;
--replace_column 2 # 5 # source include/show_binlog_events.inc;
show binlog events from 106;
select count(*) from ti /* zero */; select count(*) from ti /* zero */;
insert into ti select * from tt; insert into ti select * from tt;
select * from ti /* that is what slave would miss - a bug */; select * from ti /* that is what slave would miss - bug#28960 */;
## send_error() branch ## send_error() branch
...@@ -78,13 +77,12 @@ rollback; ...@@ -78,13 +77,12 @@ rollback;
# check # check
show master status; show master status;
--replace_column 2 # 5 # source include/show_binlog_events.inc;
show binlog events from 106;
select count(*) from ti /* zero */; select count(*) from ti /* zero */;
insert into ti select * from tt; insert into ti select * from tt;
select * from tt /* that is what otherwise slave missed - the bug */; select * from tt /* that is what otherwise slave missed - the bug */;
drop table ti,tt; drop table ti;
# #
...@@ -123,16 +121,14 @@ reset master; ...@@ -123,16 +121,14 @@ reset master;
--error ER_DUP_ENTRY --error ER_DUP_ENTRY
insert into t2 values (bug27417(2)); insert into t2 values (bug27417(2));
#TODO: Andrei: enable this test after 23333 is pushed show master status; /* only (!) with fixes for #23333 will show there is the query */;
#show master status; /* only (!) with fixes for #23333 will show there is the query */;
select count(*) from t1 /* must be 3 */; select count(*) from t1 /* must be 3 */;
reset master; reset master;
select count(*) from t2; select count(*) from t2;
delete from t2 where a=bug27417(3); delete from t2 where a=bug27417(3);
select count(*) from t2 /* nothing got deleted */; select count(*) from t2 /* nothing got deleted */;
#TODO: Andrei: enable this test after 23333 is pushed show master status; /* the query must be in regardless of #23333 */;
#show master status; /* the query must be in regardless of #23333 */;
select count(*) from t1 /* must be 5 */; select count(*) from t1 /* must be 5 */;
--enable_info --enable_info
...@@ -140,7 +136,125 @@ delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */; ...@@ -140,7 +136,125 @@ delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */;
--disable_info --disable_info
select count(*) from t1 /* must be 7 */; select count(*) from t1 /* must be 7 */;
drop function bug27417; # function bug27417 remains for the following testing of bug#23333
drop table t1,t2; 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);
#
# 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 (multi-update see bug#27716)
#
# 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 */;
#
# DELETE (for multi-delete see Bug #29136)
#
# 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 */;
#
# 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;
drop table t1,t2,t3,t4;
drop function bug27417;
--echo end of tests --echo end of tests
...@@ -34,7 +34,7 @@ Master_User root ...@@ -34,7 +34,7 @@ Master_User root
Master_Port MASTER_MYPORT Master_Port MASTER_MYPORT
Connect_Retry 1 Connect_Retry 1
Master_Log_File master-bin.000001 Master_Log_File master-bin.000001
Read_Master_Log_Pos 2138 Read_Master_Log_Pos #
Relay_Log_File # Relay_Log_File #
Relay_Log_Pos # Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001 Relay_Master_Log_File master-bin.000001
...@@ -49,7 +49,7 @@ Replicate_Wild_Ignore_Table ...@@ -49,7 +49,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0 Last_Errno 0
Last_Error Last_Error
Skip_Counter 0 Skip_Counter 0
Exec_Master_Log_Pos 2138 Exec_Master_Log_Pos #
Relay_Log_Space # Relay_Log_Space #
Until_Condition None Until_Condition None
Until_Log_File Until_Log_File
...@@ -61,3 +61,8 @@ Master_SSL_Cert ...@@ -61,3 +61,8 @@ Master_SSL_Cert
Master_SSL_Cipher Master_SSL_Cipher
Master_SSL_Key Master_SSL_Key
Seconds_Behind_Master # Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno 0
Last_SQL_Error
...@@ -70,7 +70,7 @@ connection slave; ...@@ -70,7 +70,7 @@ connection slave;
--source include/wait_for_slave_io_to_stop.inc --source include/wait_for_slave_io_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_MYPORT --replace_result $MASTER_MYPORT MASTER_MYPORT
# import is only the 11th column Slave_IO_Running # import is only the 11th column Slave_IO_Running
--replace_column 1 # 8 # 9 # 12 # 23 # 33 # --replace_column 1 # 7 # 8 # 9 # 12 # 22 # 23 # 33 #
query_vertical show slave status; query_vertical show slave status;
# End of tests # End of tests
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment