Commit fabaa50c authored by mkindahl@dl145h.mysql.com's avatar mkindahl@dl145h.mysql.com

Merge mkindahl@bk-internal.mysql.com:/home/bk/mysql-5.1-new-rpl

into  dl145h.mysql.com:/data0/mkindahl/mysql-5.1-rpl
parents b1f2a84b 29c55e41
......@@ -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
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
......@@ -40,6 +40,44 @@ SELECT * FROM t1 ORDER BY n;
t n
2004-01-01 00:00:00 5
2004-06-11 09:39:02 6
select * from t1;
t
2004-01-01 00:00:00
2004-06-11 09:39:02
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=100000000/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
create table t1 (t timestamp)
/*!*/;
SET TIMESTAMP=100000000/*!*/;
create table t2 (t char(32))
/*!*/;
SET TIMESTAMP=100000000/*!*/;
SET @@session.time_zone='Europe/Moscow'/*!*/;
insert into t1 values ('20050101000000'), ('20050611093902')
/*!*/;
SET TIMESTAMP=100000000/*!*/;
SET @@session.time_zone='UTC'/*!*/;
insert into t1 values ('20040101000000'), ('20040611093902')
/*!*/;
SET TIMESTAMP=100000000/*!*/;
delete from t1
/*!*/;
SET TIMESTAMP=100000000/*!*/;
SET @@session.time_zone='Europe/Moscow'/*!*/;
insert into t1 values ('20040101000000'), ('20040611093902')
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
delete from t1;
set time_zone='UTC';
load data infile '../std_data_ln/rpl_timezone2.dat' into table t1;
......
# Test case for bug#32205 Replaying statements from mysqlbinlog fails
# with a syntax error, replicates fine
-- source include/have_log_bin.inc
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
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;
--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 | $MYSQL
flush logs;
select * from t2;
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