mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Merge lthalmann@bk-internal.mysql.com:/home/bk/mysql-5.1-new-rpl
into mysql.com:/nfsdisk1/lars/bkroot/mysql-5.1-new-rpl
This commit is contained in:
@@ -0,0 +1,234 @@
|
||||
# the file to be sourced from binlog.binlog_mix_innodb_myisam
|
||||
|
||||
#
|
||||
# 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.
|
||||
|
||||
# checking binlog content filled with row-based events due to
|
||||
# a used stored function modifies non-transactional table
|
||||
|
||||
## 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;
|
||||
source include/show_binlog_events.inc;
|
||||
select count(*) from ti /* zero */;
|
||||
insert into ti select * from tt;
|
||||
select * from ti /* that is what slave would miss - bug#28960 */;
|
||||
|
||||
|
||||
## 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;
|
||||
source include/show_binlog_events.inc; # nothing in binlog with row bilog format
|
||||
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));
|
||||
source include/show_binlog_events.inc; #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 */;
|
||||
source include/show_binlog_events.inc; # 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
|
||||
|
||||
source include/show_binlog_events.inc; # must be event of 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
|
||||
|
||||
source include/show_binlog_events.inc; # must be events of 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
|
||||
source include/show_binlog_events.inc; # must be events of 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
|
||||
source include/show_binlog_events.inc; # must be events of 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 */;
|
||||
source include/show_binlog_events.inc; # must be events of the query
|
||||
|
||||
#
|
||||
# bug#23333 cleanup
|
||||
#
|
||||
drop trigger trg_del;
|
||||
drop table t1,t2,t3,t4;
|
||||
drop function bug27417;
|
||||
@@ -413,3 +413,189 @@ select
|
||||
@a like "%#%error_code=0%ROLLBACK/*!*/;%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 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
|
||||
master-bin.000001 # Table_map # # table_id: # (test.ti)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Table_map # # table_id: # (test.ti)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # 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 - bug#28960 */;
|
||||
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 <binlog_start>;
|
||||
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;
|
||||
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 binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Intvar # # INSERT_ID=3
|
||||
master-bin.000001 # Query # # use `test`; insert into t2 values (bug27417(2))
|
||||
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 binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Intvar # # INSERT_ID=4
|
||||
master-bin.000001 # Query # # use `test`; delete from t2 where a=bug27417(3)
|
||||
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);
|
||||
insert into t2 values (1);
|
||||
reset master;
|
||||
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 # Intvar # # INSERT_ID=1
|
||||
master-bin.000001 # Query # # use `test`; insert into t2 values (bug27417(1))
|
||||
master-bin.000001 # Query # # use `test`; ROLLBACK
|
||||
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 binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
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
|
||||
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 binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Intvar # # INSERT_ID=4
|
||||
master-bin.000001 # Query # # use `test`; update t3 set b=b+bug27417(1)
|
||||
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 binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Intvar # # INSERT_ID=6
|
||||
master-bin.000001 # Query # # use `test`; delete from t2
|
||||
master-bin.000001 # Query # # use `test`; ROLLBACK
|
||||
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 binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Intvar # # INSERT_ID=7
|
||||
master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=12
|
||||
master-bin.000001 # Intvar # # INSERT_ID=7
|
||||
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;
|
||||
drop table t1,t2,t3,t4;
|
||||
drop function bug27417;
|
||||
|
||||
@@ -380,6 +380,7 @@ select
|
||||
@a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%"
|
||||
1 1
|
||||
drop table t1, t2;
|
||||
set @@session.binlog_format=statement;
|
||||
create temporary table tt (a int unique);
|
||||
create table ti (a int) engine=innodb;
|
||||
reset master;
|
||||
@@ -465,9 +466,8 @@ insert into t2 values (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 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Intvar # # INSERT_ID=3
|
||||
master-bin.000001 # Query # # use `test`; insert into t2 values (bug27417(2))
|
||||
select count(*) from t1 /* must be 3 */;
|
||||
count(*)
|
||||
3
|
||||
@@ -481,9 +481,8 @@ count(*)
|
||||
2
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Intvar # # INSERT_ID=4
|
||||
master-bin.000001 # Query # # use `test`; delete from t2 where a=bug27417(3)
|
||||
select count(*) from t1 /* must be 5 */;
|
||||
count(*)
|
||||
5
|
||||
@@ -502,9 +501,8 @@ 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 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
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
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
count(*)
|
||||
@@ -517,10 +515,8 @@ 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 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: #
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
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
|
||||
select count(*) from t1 /* must be 2 */;
|
||||
count(*)
|
||||
@@ -532,11 +528,8 @@ update t3 set b=b+bug27417(1);
|
||||
ERROR 23000: Duplicate entry '4' for key 'b'
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t3)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: #
|
||||
master-bin.000001 # Update_rows # # table_id: #
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Intvar # # INSERT_ID=4
|
||||
master-bin.000001 # Query # # use `test`; update t3 set b=b+bug27417(1)
|
||||
select count(*) from t1 /* must be 2 */;
|
||||
count(*)
|
||||
2
|
||||
@@ -552,10 +545,8 @@ 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 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t3)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Intvar # # INSERT_ID=6
|
||||
master-bin.000001 # Query # # use `test`; delete from t2
|
||||
master-bin.000001 # Query # # use `test`; ROLLBACK
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
count(*)
|
||||
@@ -574,13 +565,13 @@ count(*)
|
||||
2
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t4)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: #
|
||||
master-bin.000001 # Write_rows # # table_id: #
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Intvar # # INSERT_ID=7
|
||||
master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=12
|
||||
master-bin.000001 # Intvar # # INSERT_ID=7
|
||||
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;
|
||||
drop table t1,t2,t3,t4;
|
||||
drop function bug27417;
|
||||
set @@session.binlog_format=@@global.binlog_format;
|
||||
end of tests
|
||||
|
||||
@@ -31,3 +31,5 @@ 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
|
||||
|
||||
@@ -24,237 +24,9 @@ eval select
|
||||
|
||||
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;
|
||||
source include/show_binlog_events.inc;
|
||||
select count(*) from ti /* zero */;
|
||||
insert into ti select * from tt;
|
||||
select * from ti /* that is what slave would miss - bug#28960 */;
|
||||
|
||||
|
||||
## 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;
|
||||
source include/show_binlog_events.inc;
|
||||
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));
|
||||
source include/show_binlog_events.inc; #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 */;
|
||||
source include/show_binlog_events.inc; # 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
|
||||
|
||||
source include/show_binlog_events.inc; # must be event of 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
|
||||
|
||||
source include/show_binlog_events.inc; # must be events of 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
|
||||
source include/show_binlog_events.inc; # must be events of 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
|
||||
source include/show_binlog_events.inc; # must be events of 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 */;
|
||||
source include/show_binlog_events.inc; # must be events of the query
|
||||
|
||||
#
|
||||
# bug#23333 cleanup
|
||||
#
|
||||
|
||||
|
||||
drop trigger trg_del;
|
||||
drop table t1,t2,t3,t4;
|
||||
drop function bug27417;
|
||||
set @@session.binlog_format=statement;
|
||||
-- source extra/binlog_tests/mix_innodb_myisam_side_effects.test
|
||||
set @@session.binlog_format=@@global.binlog_format;
|
||||
|
||||
|
||||
--echo end of tests
|
||||
|
||||
Reference in New Issue
Block a user