Commit 70488d7d authored by bar@bar.myoffice.izhnet.ru's avatar bar@bar.myoffice.izhnet.ru

Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-5.1

into  mysql.com:/home/bar/mysql-work/mysql-5.1-new-rpl-merge
parents e3f77622 c1f751ba
......@@ -1087,6 +1087,17 @@ static int read_and_execute(bool interactive)
if (!interactive)
{
line=batch_readline(status.line_buff);
/*
Skip UTF8 Byte Order Marker (BOM) 0xEFBBBF.
Editors like "notepad" put this marker in
the very beginning of a text file when
you save the file using "Unicode UTF-8" format.
*/
if (!line_number &&
(uchar) line[0] == 0xEF &&
(uchar) line[1] == 0xBB &&
(uchar) line[2] == 0xBF)
line+= 3;
line_number++;
if (!glob_buffer.length())
status.query_start_line=line_number;
......
......@@ -407,9 +407,11 @@ enum ha_base_keytype {
#define HA_ERR_RECORD_IS_THE_SAME 169 /* row not actually updated :
new values same as the old values */
#define HA_ERR_LOGGING_IMPOSSIBLE 170 /* It is not possible to log this
statement */
#define HA_ERR_LAST 170 /*Copy last error nr.*/
#define HA_ERR_LOGGING_IMPOSSIBLE 170 /* It is not possible to log this
statement */
#define HA_ERR_CORRUPT_EVENT 171 /* The event was corrupt, leading to
illegal data being read */
#define HA_ERR_LAST 171 /*Copy last error nr.*/
/* Add error numbers before HA_ERR_LAST and change it accordingly. */
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
......
# 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) 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
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 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
source include/show_binlog_events.inc; # must be events of 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
source include/show_binlog_events.inc; # 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
source include/show_binlog_events.inc; # 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
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_t2;
drop table t1,t2,t3,t4,t5;
drop function bug27417;
......@@ -466,7 +466,7 @@ binary data';
select * from t2 order by f1;
select * from t3 order by f1;
select * from t4 order by f1;
select * from t31 order by f1;
select * from t31 order by f3;
connection master;
......
......@@ -736,7 +736,7 @@ connection slave;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
--echo *** Try to insert in master ****
......@@ -744,6 +744,8 @@ connection master;
INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2);
SELECT * FROM t15 ORDER BY c1;
#SHOW BINLOG EVENTS;
--echo *** Try to select from slave ****
sync_slave_with_master;
--replace_column 7 CURRENT_TIMESTAMP
......
#
# To test a desired collation, set session.collation_connection to
# this collation before including this file
#
--disable_warnings
drop table if exists t1;
--enable_warnings
#
# Create a table with two varchar(64) null-able column,
# using current values of
# @@character_set_connection and @@collation_connection.
#
create table t1 as
select repeat(' ', 64) as s1, repeat(' ',64) as s2
union
select null, null;
show create table t1;
delete from t1;
insert into t1 values('aaa','aaa');
insert into t1 values('aaa|qqq','qqq');
insert into t1 values('gheis','^[^a-dXYZ]+$');
insert into t1 values('aab','^aa?b');
insert into t1 values('Baaan','^Ba*n');
insert into t1 values('aaa','qqq|aaa');
insert into t1 values('qqq','qqq|aaa');
insert into t1 values('bbb','qqq|aaa');
insert into t1 values('bbb','qqq');
insert into t1 values('aaa','aba');
insert into t1 values(null,'abc');
insert into t1 values('def',null);
insert into t1 values(null,null);
insert into t1 values('ghi','ghi[');
select HIGH_PRIORITY s1 regexp s2 from t1;
drop table t1;
###################################################
#Author: Sven
#Date: 2007-10-09
#Purpose: Wait until the slave has an error in the
# sql thread, as indicated by
# "SHOW SLAVE STATUS", or at most 30
# seconds.
#Details:
# 1) Fill in and setup variables
# 2) loop, looking for sql error on slave
# 3) If it loops too long, die.
####################################################
connection slave;
let $row_number= 1;
let $run= 1;
let $counter= 300;
while ($run)
{
let $sql_result= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, $row_number);
let $run= `SELECT '$sql_result' = '0'`;
if ($run) {
real_sleep 0.1;
if (!$counter){
--echo "Failed while waiting for slave to produce an error in its sql thread"
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
query_vertical SHOW SLAVE STATUS;
exit;
}
dec $counter;
}
}
......@@ -178,3 +178,44 @@ hex(a)
A2E6
FEF7
DROP TABLE t1;
create table t1 (s1 varchar(5) character set euckr);
insert into t1 values (0xA141);
insert into t1 values (0xA15A);
insert into t1 values (0xA161);
insert into t1 values (0xA17A);
insert into t1 values (0xA181);
insert into t1 values (0xA1FE);
insert into t1 values (0xA140);
Warnings:
Warning 1366 Incorrect string value: '\xA1@' for column 's1' at row 1
insert into t1 values (0xA15B);
Warnings:
Warning 1366 Incorrect string value: '\xA1[' for column 's1' at row 1
insert into t1 values (0xA160);
Warnings:
Warning 1366 Incorrect string value: '\xA1`' for column 's1' at row 1
insert into t1 values (0xA17B);
Warnings:
Warning 1366 Incorrect string value: '\xA1{' for column 's1' at row 1
insert into t1 values (0xA180);
Warnings:
Warning 1366 Incorrect string value: '\xA1\x80' for column 's1' at row 1
insert into t1 values (0xA1FF);
Warnings:
Warning 1366 Incorrect string value: '\xA1\xFF' for column 's1' at row 1
select hex(s1), hex(convert(s1 using utf8)) from t1 order by binary s1;
hex(s1) hex(convert(s1 using utf8))
A141 ECA2A5
A15A ECA381
A161 ECA382
A17A ECA3A5
A181 ECA3A6
A1FE EFBFA2
drop table t1;
End of 5.0 tests
......@@ -2767,4 +2767,49 @@ a
c
ch
drop table t1;
set collation_connection=ucs2_unicode_ci;
drop table if exists t1;
create table t1 as
select repeat(' ', 64) as s1, repeat(' ',64) as s2
union
select null, null;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`s1` varchar(64) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci DEFAULT NULL,
`s2` varchar(64) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
delete from t1;
insert into t1 values('aaa','aaa');
insert into t1 values('aaa|qqq','qqq');
insert into t1 values('gheis','^[^a-dXYZ]+$');
insert into t1 values('aab','^aa?b');
insert into t1 values('Baaan','^Ba*n');
insert into t1 values('aaa','qqq|aaa');
insert into t1 values('qqq','qqq|aaa');
insert into t1 values('bbb','qqq|aaa');
insert into t1 values('bbb','qqq');
insert into t1 values('aaa','aba');
insert into t1 values(null,'abc');
insert into t1 values('def',null);
insert into t1 values(null,null);
insert into t1 values('ghi','ghi[');
select HIGH_PRIORITY s1 regexp s2 from t1;
s1 regexp s2
1
1
1
1
1
1
1
0
0
0
NULL
NULL
NULL
NULL
drop table t1;
set names utf8;
End for 5.0 tests
......@@ -922,6 +922,51 @@ ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_gen
select * from t1 where a=if(b<10,_ucs2 0x0062,_ucs2 0x00C0);
ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation '='
drop table t1;
set collation_connection=ucs2_general_ci;
drop table if exists t1;
create table t1 as
select repeat(' ', 64) as s1, repeat(' ',64) as s2
union
select null, null;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`s1` varchar(64) CHARACTER SET ucs2 DEFAULT NULL,
`s2` varchar(64) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
delete from t1;
insert into t1 values('aaa','aaa');
insert into t1 values('aaa|qqq','qqq');
insert into t1 values('gheis','^[^a-dXYZ]+$');
insert into t1 values('aab','^aa?b');
insert into t1 values('Baaan','^Ba*n');
insert into t1 values('aaa','qqq|aaa');
insert into t1 values('qqq','qqq|aaa');
insert into t1 values('bbb','qqq|aaa');
insert into t1 values('bbb','qqq');
insert into t1 values('aaa','aba');
insert into t1 values(null,'abc');
insert into t1 values('def',null);
insert into t1 values(null,null);
insert into t1 values('ghi','ghi[');
select HIGH_PRIORITY s1 regexp s2 from t1;
s1 regexp s2
1
1
1
1
1
1
1
0
0
0
NULL
NULL
NULL
NULL
drop table t1;
set names latin1;
select hex(char(0x41 using ucs2));
hex(char(0x41 using ucs2))
0041
......
......@@ -267,6 +267,51 @@ b
select * from t1 where a = 'b' and a != 'b';
a
drop table t1;
set collation_connection=utf8_general_ci;
drop table if exists t1;
create table t1 as
select repeat(' ', 64) as s1, repeat(' ',64) as s2
union
select null, null;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`s1` varchar(64) CHARACTER SET utf8 DEFAULT NULL,
`s2` varchar(64) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
delete from t1;
insert into t1 values('aaa','aaa');
insert into t1 values('aaa|qqq','qqq');
insert into t1 values('gheis','^[^a-dXYZ]+$');
insert into t1 values('aab','^aa?b');
insert into t1 values('Baaan','^Ba*n');
insert into t1 values('aaa','qqq|aaa');
insert into t1 values('qqq','qqq|aaa');
insert into t1 values('bbb','qqq|aaa');
insert into t1 values('bbb','qqq');
insert into t1 values('aaa','aba');
insert into t1 values(null,'abc');
insert into t1 values('def',null);
insert into t1 values(null,null);
insert into t1 values('ghi','ghi[');
select HIGH_PRIORITY s1 regexp s2 from t1;
s1 regexp s2
1
1
1
1
1
1
1
0
0
0
NULL
NULL
NULL
NULL
drop table t1;
set names utf8;
set names utf8;
select 'вася' rlike '[[:<:]]вася[[:>:]]';
'вася' rlike '[[:<:]]вася[[:>:]]'
......
drop table if exists t1;
create table t1 (s1 char(64),s2 char(64));
set names latin1;
drop table if exists t1;
create table t1 as
select repeat(' ', 64) as s1, repeat(' ',64) as s2
union
select null, null;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`s1` varchar(64) DEFAULT NULL,
`s2` varchar(64) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
delete from t1;
insert into t1 values('aaa','aaa');
insert into t1 values('aaa|qqq','qqq');
insert into t1 values('gheis','^[^a-dXYZ]+$');
......
......@@ -1086,6 +1086,19 @@ n d
1 30
2 20
drop table t1,t2;
drop table if exists t1, t2;
CREATE TABLE t1 (a int, PRIMARY KEY (a));
CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
create trigger trg_del_t2 after delete on t2 for each row
insert into t1 values (1);
insert into t1 values (1);
insert into t2 values (1),(2);
delete t2 from t2;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select count(*) from t2 /* must be 2 as restored after rollback caused by the error */;
count(*)
2
drop table t1, t2;
create table t1 (a int, b int) engine=innodb;
insert into t1 values(20,null);
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
......@@ -1751,10 +1764,10 @@ Variable_name Value
Innodb_page_size 16384
show status like "Innodb_rows_deleted";
Variable_name Value
Innodb_rows_deleted 70
Innodb_rows_deleted 71
show status like "Innodb_rows_inserted";
Variable_name Value
Innodb_rows_inserted 1083
Innodb_rows_inserted 1085
show status like "Innodb_rows_updated";
Variable_name Value
Innodb_rows_updated 886
......
......@@ -614,6 +614,7 @@ CREATE TABLE `t2` (
`b` int(11) default NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
set @sav_binlog_format= @@session.binlog_format;
set @@session.binlog_format= mixed;
insert into t1 values (1,1),(2,2);
insert into t2 values (1,1),(4,4);
......@@ -626,7 +627,7 @@ a b
4 4
show master status /* there must be the UPDATE query event */;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 197
master-bin.000001 268
delete from t1;
delete from t2;
insert into t1 values (1,2),(3,4),(4,4);
......@@ -636,6 +637,24 @@ UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
show master status /* there must be the UPDATE query event */;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 212
master-bin.000001 283
drop table t1, t2;
set @@session.binlog_format= @sav_binlog_format;
drop table if exists t1, t2, t3;
CREATE TABLE t1 (a int, PRIMARY KEY (a));
CREATE TABLE t2 (a int, PRIMARY KEY (a));
CREATE TABLE t3 (a int, PRIMARY KEY (a)) ENGINE=MyISAM;
create trigger trg_del_t3 before delete on t3 for each row insert into t1 values (1);
insert into t2 values (1),(2);
insert into t3 values (1),(2);
reset master;
delete t3.* from t2,t3 where t2.a=t3.a;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select count(*) from t1 /* must be 1 */;
count(*)
1
select count(*) from t3 /* must be 1 */;
count(*)
1
drop table t1, t2, t3;
end of tests
......@@ -178,5 +178,7 @@ ERROR at line 1: DELIMITER cannot contain a backslash character
1
1
1
This is a file starting with UTF8 BOM 0xEFBBBF
This is a file starting with UTF8 BOM 0xEFBBBF
End of 5.0 tests
WARNING: --server-arg option not supported in this configuration.
......@@ -413,3 +413,236 @@ 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) 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 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 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 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`; UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */
master-bin.000001 # Query # # use `test`; ROLLBACK
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 binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Intvar # # INSERT_ID=9
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
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 binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
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 */;
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=10
master-bin.000001 # Begin_load_query # # ;file_id=1;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 # Query # # use `test`; ROLLBACK
drop trigger trg_del_t2;
drop table t1,t2,t3,t4,t5;
drop function bug27417;
......@@ -380,7 +380,8 @@ 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 table tt (a int unique);
set @@session.binlog_format=statement;
create temporary table tt (a int unique);
create table ti (a int) engine=innodb;
reset master;
show master status;
......@@ -399,18 +400,18 @@ count(*)
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
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
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
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Query # # use `test`; insert into ti values (1)
master-bin.000001 # Query # # use `test`; insert into ti values (2)
master-bin.000001 # Query # # use `test`; insert into tt select * from ti
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 - a bug */;
select * from ti /* that is what slave would miss - bug#28960 */;
a
1
2
......@@ -431,13 +432,13 @@ 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;
show binlog events from <binlog_start>;
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
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Query # # use `test`; insert into ti values (1)
master-bin.000001 # Query # # use `test`; insert into ti values (2) /* to make the dup error in the following */
master-bin.000001 # Query # # use `test`; insert into tt select * from ti /* one affected and error */
master-bin.000001 # Query # # use `test`; ROLLBACK
select count(*) from ti /* zero */;
count(*)
0
......@@ -446,7 +447,7 @@ select * from tt /* that is what otherwise slave missed - the bug */;
a
1
2
drop table ti,tt;
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;
......@@ -463,6 +464,10 @@ 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
......@@ -474,6 +479,10 @@ 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
......@@ -482,6 +491,134 @@ affected rows: 0
select count(*) from t1 /* must be 7 */;
count(*)
7
drop function bug27417;
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 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 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 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`; UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */
master-bin.000001 # Query # # use `test`; ROLLBACK
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 binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Intvar # # INSERT_ID=9
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
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 binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
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 */;
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=10
master-bin.000001 # Begin_load_query # # ;file_id=1;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 # Query # # use `test`; ROLLBACK
drop trigger trg_del_t2;
drop table t1,t2,t3,t4,t5;
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,123 +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.
set @@session.binlog_format=statement;
-- source extra/binlog_tests/mix_innodb_myisam_side_effects.test
set @@session.binlog_format=@@global.binlog_format;
## send_eof() branch
# prepare
create 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 106;
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 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,tt;
#
# 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));
#TODO: Andrei: enable this test after 23333 is pushed
#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 */;
#TODO: Andrei: enable this test after 23333 is pushed
#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 */;
drop function bug27417;
drop table t1,t2;
--echo end of tests
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
show slave status /* Second_behind reports 0 */;;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port 9306
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 106
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 106
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master 0
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno 0
Last_SQL_Error
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
create table t1 (f1 int);
flush logs /* contaminate rli->last_master_timestamp */;
lock table t1 write;
insert into t1 values (1);
show slave status /* bug emulated: reports slave threads starting time about 3*3 not 3 secs */;;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port 9306
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 367
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 279
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master 9
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno 0
Last_SQL_Error
unlock tables;
flush logs /* this time rli->last_master_timestamp is not affected */;
lock table t1 write;
insert into t1 values (2);
show slave status /* reports the correct diff with master query time about 3+3 secs */;;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port 9306
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 455
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 367
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master 7
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno 0
Last_SQL_Error
unlock tables;
drop table t1;
--loose-debug=d,let_first_flush_log_change_timestamp
#
# Testing replication delay reporting (bug#29309)
# there is an unavoidable non-determinism in the test
# please compare the results with the comments
#
source include/master-slave.inc;
connection master;
#connection slave;
sync_slave_with_master;
--replace_result $DEFAULT_MASTER_PORT DEFAULT_MASTER_PORT
--replace_column 1 # 8 # 9 # 23 #
--query_vertical show slave status /* Second_behind reports 0 */;
sleep 3;
### bug emulation
connection master;
drop table if exists t1;
create table t1 (f1 int);
sleep 3;
#connection slave;
sync_slave_with_master;
flush logs /* contaminate rli->last_master_timestamp */;
connection slave;
lock table t1 write;
connection master;
insert into t1 values (1);
sleep 3;
connection slave;
--replace_result $DEFAULT_MASTER_PORT DEFAULT_MASTER_PORT
--replace_column 1 # 8 # 9 # 23 #
--query_vertical show slave status /* bug emulated: reports slave threads starting time about 3*3 not 3 secs */;
unlock tables;
connection master;
sync_slave_with_master;
### bugfix
connection slave;
flush logs /* this time rli->last_master_timestamp is not affected */;
lock table t1 write;
connection master;
insert into t1 values (2);
sleep 3;
connection slave;
--replace_result $DEFAULT_MASTER_PORT DEFAULT_MASTER_PORT
--replace_column 1 # 8 # 9 # 23 #
--query_vertical show slave status /* reports the correct diff with master query time about 3+3 secs */;
unlock tables;
connection master;
drop table t1;
#connection slave;
sync_slave_with_master;
# End of tests
1|master only
2|master only
3|master only
......@@ -7,15 +7,15 @@
--echo ==========MASTER==========
SELECT COUNT(*) FROM t1;
SELECT * FROM t1;
SELECT * FROM t1 ORDER BY a;
SELECT COUNT(*) FROM t2;
SELECT * FROM t2;
SELECT * FROM t2 ORDER BY a;
sync_slave_with_master;
--echo ==========SLAVE===========
USE test_rpl;
SELECT COUNT(*) FROM t1;
SELECT * FROM t1;
SELECT * FROM t1 ORDER BY a;
SELECT COUNT(*) FROM t2;
SELECT * FROM t2;
SELECT * FROM t2 ORDER BY a;
connection master;
......@@ -7,11 +7,11 @@
--echo ==========MASTER==========
SHOW CREATE VIEW v1;
SELECT * FROM v1;
SELECT * FROM v1 ORDER BY a;
sync_slave_with_master;
--echo ==========SLAVE===========
USE test_rpl;
SHOW CREATE VIEW v1;
SELECT * FROM v1;
SELECT * FROM v1 ORDER BY a;
connection master;
......@@ -54,7 +54,7 @@ DELETE FROM t2 WHERE a = 2;
--exec cp ./suite/rpl/data/rpl_mixed.dat $MYSQLTEST_VARDIR/tmp/
LOAD DATA INFILE '../tmp/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;
--exec rm $MYSQLTEST_VARDIR/tmp/rpl_mixed.dat
SELECT * FROM t1;
SELECT * FROM t1 ORDER BY a;
--source suite/rpl/include/rpl_mixed_check_select.inc
--source suite/rpl/include/rpl_mixed_clear_tables.inc
......@@ -75,7 +75,7 @@ DELETE FROM t1 WHERE a = 2;
--echo
--echo ******************** SELECT ********************
INSERT INTO t1 VALUES(1, 't1, text 1');
SELECT * FROM t1 WHERE b <> UUID();
SELECT * FROM t1 WHERE b <> UUID() ORDER BY a;
--source suite/rpl/include/rpl_mixed_clear_tables.inc
# JOIN
......@@ -85,8 +85,8 @@ INSERT INTO t1 VALUES(1, 'CCC');
INSERT INTO t1 VALUES(2, 'DDD');
INSERT INTO t2 VALUES(1, 'DDD');
INSERT INTO t2 VALUES(2, 'CCC');
SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a;
SELECT * FROM t1 INNER JOIN t2 ON t1.b = t2.b;
SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a ORDER BY t1.a,t2.a;
SELECT * FROM t1 INNER JOIN t2 ON t1.b = t2.b ORDER BY t1.a,t2.a;
--source suite/rpl/include/rpl_mixed_clear_tables.inc
# UNION
......
......@@ -707,7 +707,7 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1060
Last_SQL_Error Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
*** Try to insert in master ****
INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2);
......@@ -723,6 +723,7 @@ c1 c2 c3 c4 c5 c6 c7
1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
5 2.00 Replication Testing b1b1b1b1b1b1b1b1 Buda 2 CURRENT_TIMESTAMP
*** DROP TABLE t15 ***
DROP TABLE t15;
*** Create t16 on slave ***
......
......@@ -707,7 +707,7 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1060
Last_SQL_Error Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
*** Try to insert in master ****
INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2);
......@@ -723,6 +723,7 @@ c1 c2 c3 c4 c5 c6 c7
1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
5 2.00 Replication Testing b1b1b1b1b1b1b1b1 Buda 2 CURRENT_TIMESTAMP
*** DROP TABLE t15 ***
DROP TABLE t15;
*** Create t16 on slave ***
......
......@@ -17,13 +17,13 @@ DROP EVENT IF EXISTS e11;
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=myisam;
INSERT INTO t1 VALUES (1,1,'1');
INSERT INTO t1 VALUES (2,2,UUID());
CREATE TABLE t2 (a INT, b INT, c VARCHAR(64)) ENGINE=myisam;
CREATE TABLE t2 (a INT UNIQUE, b INT, c VARCHAR(64)) ENGINE=myisam;
INSERT INTO t2 VALUES (1,1,'1');
INSERT INTO t2 VALUES (2,2,UUID());
CREATE TABLE t11 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=innodb;
INSERT INTO t11 VALUES (1,1,'1');
INSERT INTO t11 VALUES (2,2,UUID());
CREATE TABLE t12 (a INT, b INT, c VARCHAR(64)) ENGINE=innodb;
CREATE TABLE t12 (a INT UNIQUE, b INT, c VARCHAR(64)) ENGINE=innodb;
INSERT INTO t12 VALUES (1,1,'1');
INSERT INTO t12 VALUES (2,2,UUID());
......@@ -49,21 +49,15 @@ BEGIN
UPDATE t12 SET c = '';
UPDATE t13 SET c = '';
END|
CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND ENABLE DO
CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DISABLE DO
BEGIN
DECLARE c INT;
SELECT a INTO c FROM t1 WHERE a < 11 ORDER BY a DESC LIMIT 1;
IF c = 7 THEN
ALTER EVENT e1 DISABLE;
CALL p1(10, '');
END IF;
END|
CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND ENABLE DO
CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND DISABLE DO
BEGIN
DECLARE c INT;
SELECT a INTO c FROM t11 WHERE a < 11 ORDER BY a DESC LIMIT 1;
IF c = 7 THEN
ALTER EVENT e11 DISABLE;
CALL p11(10, '');
END IF;
END|
CREATE FUNCTION f1 (x INT) RETURNS VARCHAR(64)
BEGIN
......@@ -78,11 +72,11 @@ RETURN f1(x);
END|
CREATE PROCEDURE p1 (IN x INT, IN y VARCHAR(64))
BEGIN
INSERT INTO t1 VALUES (x,x,y);
INSERT IGNORE INTO t1 VALUES (x,x,y);
END|
CREATE PROCEDURE p11 (IN x INT, IN y VARCHAR(64))
BEGIN
INSERT INTO t11 VALUES (x,x,y);
INSERT IGNORE INTO t11 VALUES (x,x,y);
END|
CREATE TABLE t3 SELECT * FROM v1;
......@@ -110,6 +104,8 @@ INSERT INTO t11 VALUES(7,7,f2(7));
INSERT INTO t11 VALUES (103,103,'');
SET GLOBAL EVENT_SCHEDULER = on;
ALTER EVENT e1 ENABLE;
ALTER EVENT e11 ENABLE;
SET GLOBAL EVENT_SCHEDULER = off;
SHOW TABLES LIKE 't%';
......@@ -138,8 +134,8 @@ PROCEDURE p1
PROCEDURE p11
SELECT event_name, status FROM information_schema.events WHERE event_schema='test';
event_name status
e1 ENABLED
e11 ENABLED
e1 DISABLED
e11 DISABLED
SELECT COUNT(*) FROM t1;
COUNT(*)
......@@ -438,6 +434,8 @@ UPDATE t3 SET c='';
UPDATE t11 SET c='';
UPDATE t12 SET c='';
UPDATE t13 SET c='';
ALTER TABLE t3 ORDER BY a;
ALTER TABLE t13 ORDER BY a;
......
......@@ -27,6 +27,42 @@ STOP SLAVE;
START SLAVE;
CREATE TABLe `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
SHOW STATUS LIKE 'Slave_running';
Variable_name Value
Slave_running OFF
show slave status;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_MYPORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running No
Slave_SQL_Running #
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno 0
Last_SQL_Error
......@@ -242,3 +242,34 @@ a b
3 1
4 4
drop table t1,t2;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
**** On Master ****
SET SESSION BINLOG_FORMAT=ROW;
CREATE TABLE t1 (a INT PRIMARY KEY, b SET('master','slave'));
INSERT INTO t1 VALUES (1,'master,slave'), (2,'master,slave');
**** On Slave ****
UPDATE t1 SET a = 5, b = 'slave' WHERE a = 1;
SELECT * FROM t1 ORDER BY a;
a b
2 master,slave
5 slave
**** On Master ****
UPDATE t1 SET a = 5, b = 'master' WHERE a = 1;
SELECT * FROM t1 ORDER BY a;
a b
2 master,slave
5 master
**** On Slave ****
Last_SQL_Error
SELECT * FROM t1 ORDER BY a;
a b
2 master,slave
5 slave
DROP TABLE t1;
**** On Master ****
DROP TABLE t1;
......@@ -29,8 +29,7 @@ select * from t1;
a
1
2
3
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 786 # # master-bin.000001 Yes Yes 0 0 786 # None 0 No # No 0 0
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 851 # # master-bin.000001 Yes Yes 0 0 851 # None 0 No # No 0 0
drop table t1;
......@@ -142,3 +142,211 @@ Last_SQL_Errno 0
Last_SQL_Error
**** On Master ****
DROP TABLE t1, t2;
SET SESSION BINLOG_FORMAT=ROW;
SET AUTOCOMMIT=0;
CREATE TABLE t1 (a INT, b VARCHAR(20)) ENGINE=myisam;
CREATE TABLE t2 (a INT, b VARCHAR(20)) ENGINE=myisam;
CREATE TABLE t3 (a INT, b VARCHAR(20)) ENGINE=myisam;
INSERT INTO t1 VALUES (1,'master/slave');
INSERT INTO t2 VALUES (1,'master/slave');
INSERT INTO t3 VALUES (1,'master/slave');
CREATE TRIGGER tr1 AFTER UPDATE on t1 FOR EACH ROW
BEGIN
INSERT INTO t2 VALUES (NEW.a,NEW.b);
DELETE FROM t2 WHERE a < NEW.a;
END|
CREATE TRIGGER tr2 AFTER INSERT on t2 FOR EACH ROW
BEGIN
UPDATE t3 SET a =2, b = 'master only';
END|
**** On Slave ****
STOP SLAVE;
**** On Master ****
UPDATE t1 SET a = 2, b = 'master only' WHERE a = 1;
DROP TRIGGER tr1;
DROP TRIGGER tr2;
INSERT INTO t1 VALUES (3,'master/slave');
INSERT INTO t2 VALUES (3,'master/slave');
INSERT INTO t3 VALUES (3,'master/slave');
SELECT * FROM t1 ORDER BY a;
a b
2 master only
3 master/slave
SELECT * FROM t2 ORDER BY a;
a b
2 master only
3 master/slave
SELECT * FROM t3 ORDER BY a;
a b
2 master only
3 master/slave
*** On Slave ***
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
SELECT * FROM t1 ORDER BY a;
a b
1 master/slave
3 master/slave
SELECT * FROM t2 ORDER BY a;
a b
1 master/slave
3 master/slave
SELECT * FROM t3 ORDER BY a;
a b
1 master/slave
3 master/slave
DROP TABLE t1, t2, t3;
**** Case 2: Row binlog format and transactional tables ****
*** On Master ***
CREATE TABLE t4 (a INT, b VARCHAR(20)) ENGINE=innodb;
CREATE TABLE t5 (a INT, b VARCHAR(20)) ENGINE=innodb;
CREATE TABLE t6 (a INT, b VARCHAR(20)) ENGINE=innodb;
**** On Slave ****
STOP SLAVE;
*** On Master ***
BEGIN;
INSERT INTO t4 VALUES (2, 'master only');
INSERT INTO t5 VALUES (2, 'master only');
INSERT INTO t6 VALUES (2, 'master only');
COMMIT;
BEGIN;
INSERT INTO t4 VALUES (3, 'master/slave');
INSERT INTO t5 VALUES (3, 'master/slave');
INSERT INTO t6 VALUES (3, 'master/slave');
COMMIT;
SELECT * FROM t4 ORDER BY a;
a b
2 master only
3 master/slave
SELECT * FROM t5 ORDER BY a;
a b
2 master only
3 master/slave
SELECT * FROM t6 ORDER BY a;
a b
2 master only
3 master/slave
*** On Slave ***
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
SELECT * FROM t4 ORDER BY a;
a b
3 master/slave
SELECT * FROM t5 ORDER BY a;
a b
3 master/slave
SELECT * FROM t6 ORDER BY a;
a b
3 master/slave
**** On Slave ****
STOP SLAVE;
*** On Master ***
BEGIN;
INSERT INTO t4 VALUES (6, 'master only');
INSERT INTO t5 VALUES (6, 'master only');
INSERT INTO t6 VALUES (6, 'master only');
COMMIT;
BEGIN;
INSERT INTO t4 VALUES (7, 'master only');
INSERT INTO t5 VALUES (7, 'master only');
INSERT INTO t6 VALUES (7, 'master only');
COMMIT;
SELECT * FROM t4 ORDER BY a;
a b
2 master only
3 master/slave
6 master only
7 master only
SELECT * FROM t5 ORDER BY a;
a b
2 master only
3 master/slave
6 master only
7 master only
SELECT * FROM t6 ORDER BY a;
a b
2 master only
3 master/slave
6 master only
7 master only
*** On Slave ***
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=10;
START SLAVE;
SELECT * FROM t4 ORDER BY a;
a b
3 master/slave
SELECT * FROM t5 ORDER BY a;
a b
3 master/slave
SELECT * FROM t6 ORDER BY a;
a b
3 master/slave
STOP SLAVE;
SET AUTOCOMMIT=0;
INSERT INTO t4 VALUES (4, 'master only');
INSERT INTO t5 VALUES (4, 'master only');
INSERT INTO t6 VALUES (4, 'master only');
COMMIT;
INSERT INTO t4 VALUES (5, 'master/slave');
INSERT INTO t5 VALUES (5, 'master/slave');
INSERT INTO t6 VALUES (5, 'master/slave');
COMMIT;
SELECT * FROM t4 ORDER BY a;
a b
2 master only
3 master/slave
4 master only
5 master/slave
6 master only
7 master only
SELECT * FROM t5 ORDER BY a;
a b
2 master only
3 master/slave
4 master only
5 master/slave
6 master only
7 master only
SELECT * FROM t6 ORDER BY a;
a b
2 master only
3 master/slave
4 master only
5 master/slave
6 master only
7 master only
*** On Slave ***
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
SELECT * FROM t4 ORDER BY a;
a b
3 master/slave
5 master/slave
SELECT * FROM t5 ORDER BY a;
a b
3 master/slave
5 master/slave
SELECT * FROM t6 ORDER BY a;
a b
3 master/slave
5 master/slave
DROP TABLE t4, t5, t6;
**** Case 3: Statement logging format and LOAD DATA with non-transactional table ****
*** On Master ***
CREATE TABLE t10 (a INT, b VARCHAR(20)) ENGINE=myisam;
*** On Slave ***
STOP SLAVE;
*** On Master ***
SET SESSION BINLOG_FORMAT=STATEMENT;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/rpl_bug28618.dat' INTO TABLE t10 FIELDS TERMINATED BY '|';
SELECT * FROM t10 ORDER BY a;
a b
1 master only
2 master only
3 master only
*** On Slave ***
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
SELECT * FROM t10 ORDER BY a;
a b
DROP TABLE t10;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
**** On Master ****
SET SESSION BINLOG_FORMAT=ROW;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
**** On Slave ****
SHOW STATUS LIKE 'Slave_retried_transactions';
Variable_name Value
Slave_retried_transactions 0
UPDATE t1 SET a = 5, b = 47 WHERE a = 1;
SELECT * FROM t1;
a b
5 47
2 2
3 3
4 4
**** On Master ****
UPDATE t1 SET a = 5, b = 5 WHERE a = 1;
SELECT * FROM t1;
a b
5 5
2 2
3 3
4 4
**** On Slave ****
SHOW STATUS LIKE 'Slave_retried_transactions';
Variable_name Value
Slave_retried_transactions 0
SELECT * FROM t1;
a b
5 47
2 2
3 3
4 4
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 408
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 408
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
DROP TABLE t1;
**** On Master ****
DROP TABLE t1;
......@@ -11,7 +11,5 @@
##############################################################################
rpl_ddl : BUG#26418 2007-03-01 mleich Slave out of sync after CREATE/DROP TEMPORARY TABLE + ROLLBACK on master
rpl_invoked_features : BUG#29020 2007-06-21 Lars Non-deterministic test case
rpl_auto_increment_11932 : Bug#29809 2007-07-16 ingo Slave SQL errors in warnings file
rpl_stm_extraColmaster_ndb : WL#3915 : Statement-based replication not supported in ndb. Enable test when supported.
rpl_row_extraColmaster_ndb : BUG#29549 : Replication of BLOBs fail for NDB
......@@ -114,4 +114,5 @@ SELECT * FROM visits_events;
# Cleanup
DROP DATABASE track;
sync_slave_with_master;
--echo End of 5.1 tests
......@@ -8,10 +8,9 @@
--source include/master-slave.inc
--source include/have_innodb.inc
#
# Define variables used by test case
#
# --disable_warnings/--enable_warnings added before/after query
# if one uses UUID() function because we need to avoid warnings
# for STATEMENT binlog format
# Non-transactional engine
--let $engine_type= myisam
......@@ -45,20 +44,24 @@ DROP EVENT IF EXISTS e11;
--echo
eval CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=$engine_type;
--disable_warnings
INSERT INTO t1 VALUES (1,1,'1');
--disable_warnings
INSERT INTO t1 VALUES (2,2,UUID());
eval CREATE TABLE t2 (a INT, b INT, c VARCHAR(64)) ENGINE=$engine_type;
--enable_warnings
eval CREATE TABLE t2 (a INT UNIQUE, b INT, c VARCHAR(64)) ENGINE=$engine_type;
INSERT INTO t2 VALUES (1,1,'1');
--disable_warnings
INSERT INTO t2 VALUES (2,2,UUID());
--enable_warnings
eval CREATE TABLE t11 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=$engine_type2;
--disable_warnings
INSERT INTO t11 VALUES (1,1,'1');
--disable_warnings
INSERT INTO t11 VALUES (2,2,UUID());
eval CREATE TABLE t12 (a INT, b INT, c VARCHAR(64)) ENGINE=$engine_type2;
--enable_warnings
eval CREATE TABLE t12 (a INT UNIQUE, b INT, c VARCHAR(64)) ENGINE=$engine_type2;
INSERT INTO t12 VALUES (1,1,'1');
--disable_warnings
INSERT INTO t12 VALUES (2,2,UUID());
--enable_warnings
......@@ -96,22 +99,16 @@ BEGIN
END|
# Create events which will run every 1 sec
CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND ENABLE DO
CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DISABLE DO
BEGIN
DECLARE c INT;
SELECT a INTO c FROM t1 WHERE a < 11 ORDER BY a DESC LIMIT 1;
IF c = 7 THEN
CALL p1(10, '');
END IF;
ALTER EVENT e1 DISABLE;
CALL p1(10, '');
END|
CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND ENABLE DO
CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND DISABLE DO
BEGIN
DECLARE c INT;
SELECT a INTO c FROM t11 WHERE a < 11 ORDER BY a DESC LIMIT 1;
IF c = 7 THEN
CALL p11(10, '');
END IF;
ALTER EVENT e11 DISABLE;
CALL p11(10, '');
END|
# Create functions and procedures used for events
......@@ -130,12 +127,12 @@ END|
CREATE PROCEDURE p1 (IN x INT, IN y VARCHAR(64))
BEGIN
INSERT INTO t1 VALUES (x,x,y);
INSERT IGNORE INTO t1 VALUES (x,x,y);
END|
CREATE PROCEDURE p11 (IN x INT, IN y VARCHAR(64))
BEGIN
INSERT INTO t11 VALUES (x,x,y);
INSERT IGNORE INTO t11 VALUES (x,x,y);
END|
DELIMITER ;|
......@@ -147,17 +144,24 @@ DELIMITER ;|
# Do some actions for non-transactional tables
--echo
--disable_warnings
CREATE TABLE t3 SELECT * FROM v1;
INSERT INTO t1 VALUES (3,3,'');
UPDATE t1 SET c='2' WHERE a = 1;
--disable_warnings
INSERT INTO t1 VALUES(4,4,f1(4));
--enable_warnings
INSERT INTO t1 VALUES (100,100,'');
--disable_warnings
CALL p1(5, UUID());
--enable_warnings
INSERT INTO t1 VALUES (101,101,'');
--disable_warnings
INSERT INTO t1 VALUES(6,6,f1(6));
--enable_warnings
INSERT INTO t1 VALUES (102,102,'');
--disable_warnings
INSERT INTO t1 VALUES(7,7,f2(7));
--enable_warnings
INSERT INTO t1 VALUES (103,103,'');
# Do some actions for transactional tables
......@@ -165,21 +169,34 @@ INSERT INTO t1 VALUES (103,103,'');
CREATE TABLE t13 SELECT * FROM v11;
INSERT INTO t11 VALUES (3,3,'');
UPDATE t11 SET c='2' WHERE a = 1;
--disable_warnings
INSERT INTO t11 VALUES(4,4,f1(4));
--enable_warnings
INSERT INTO t11 VALUES (100,100,'');
--disable_warnings
CALL p11(5, UUID());
--enable_warnings
INSERT INTO t11 VALUES (101,101,'');
--disable_warnings
INSERT INTO t11 VALUES(6,6,f1(6));
--enable_warnings
INSERT INTO t11 VALUES (102,102,'');
--disable_warnings
INSERT INTO t11 VALUES(7,7,f2(7));
INSERT INTO t11 VALUES (103,103,'');
--enable_warnings
INSERT INTO t11 VALUES (103,103,'');
# Scheduler is on
--echo
# Temporally events fire sequentally due Bug#29020.
SET GLOBAL EVENT_SCHEDULER = on;
# Wait 2 sec while events will executed
--sleep 2
# Wait while events will executed
ALTER EVENT e1 ENABLE;
let $wait_condition= SELECT COUNT(*) = 1 FROM t1 WHERE t1.a = 10;
--source include/wait_condition.inc
ALTER EVENT e11 ENABLE;
let $wait_condition= SELECT COUNT(*) = 1 FROM t11 WHERE t11.a = 10;
--source include/wait_condition.inc
SET GLOBAL EVENT_SCHEDULER = off;
# Check original objects
......@@ -234,7 +251,7 @@ SELECT COUNT(*) FROM t13;
SELECT a,b FROM t13 ORDER BY a;
SELECT a,b FROM v11 ORDER BY a;
# Remove UUID() before comparing
# Remove UUID() before comparing and sort tables
--connection master
--echo
......@@ -245,6 +262,9 @@ UPDATE t11 SET c='';
UPDATE t12 SET c='';
UPDATE t13 SET c='';
ALTER TABLE t3 ORDER BY a;
ALTER TABLE t13 ORDER BY a;
--sync_slave_with_master slave
# Compare a data from master and slave
......@@ -260,13 +280,12 @@ UPDATE t13 SET c='';
# Remove dumps
--echo
--exec rm $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_master.sql
--exec rm $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_slave.sql
--remove_file $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_master.sql
--remove_file $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_slave.sql
# Remove tables,views,procedures,functions
--connection master
--echo
--disable_warnings
DROP VIEW IF EXISTS v1,v11;
DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13;
DROP PROCEDURE IF EXISTS p1;
......@@ -275,7 +294,6 @@ DROP FUNCTION IF EXISTS f1;
DROP FUNCTION IF EXISTS f2;
DROP EVENT IF EXISTS e1;
DROP EVENT IF EXISTS e11;
--enable_warnings
--sync_slave_with_master slave
......
......@@ -66,16 +66,11 @@ CREATE TABLe `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
# The slave I/O thread must stop after trying to read the above event
connection slave;
sleep 2;
--source include/wait_for_slave_io_to_stop.inc
SHOW STATUS LIKE 'Slave_running';
# cleanup
#connection master;
#drop table t1;
#connection slave;
#drop table t1;
connection slave;
--source include/wait_for_slave_io_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_MYPORT
# import is only the 11th column Slave_IO_Running
--replace_column 1 # 7 # 8 # 9 # 12 # 22 # 23 # 33 #
query_vertical show slave status;
# End of tests
......@@ -223,3 +223,38 @@ connection master;
drop table t1,t2;
sync_slave_with_master;
#
# BUG#31702: Missing row on slave causes assertion failure under
# row-based replication
#
disable_query_log;
source include/master-slave-reset.inc;
enable_query_log;
--echo **** On Master ****
connection master;
SET SESSION BINLOG_FORMAT=ROW;
CREATE TABLE t1 (a INT PRIMARY KEY, b SET('master','slave'));
INSERT INTO t1 VALUES (1,'master,slave'), (2,'master,slave');
--echo **** On Slave ****
sync_slave_with_master;
UPDATE t1 SET a = 5, b = 'slave' WHERE a = 1;
SELECT * FROM t1 ORDER BY a;
--echo **** On Master ****
connection master;
UPDATE t1 SET a = 5, b = 'master' WHERE a = 1;
SELECT * FROM t1 ORDER BY a;
--echo **** On Slave ****
sync_slave_with_master;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
disable_query_log;
eval SELECT "$last_error" AS Last_SQL_Error;
enable_query_log;
SELECT * FROM t1 ORDER BY a;
DROP TABLE t1;
--echo **** On Master ****
connection master;
DROP TABLE t1;
......@@ -344,5 +344,6 @@ FLUSH LOGS;
--exec rm $MYSQLTEST_VARDIR/tmp/local.sql
DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5;
sync_slave_with_master;
# End of 4.1 tests
--slave-skip-error=1062,1582
--slave-skip-error=1062
......@@ -3,6 +3,14 @@
#########################################
# Note that errors are ignored by opt file.
source include/master-slave.inc;
source include/have_binlog_format_mixed_or_statement.inc;
#
# Bug #30594
# Skipping error due to applying Row-based repliation events
# should be checked with another test file
# consider names like rpl_row_skip_error
#
create table t1 (n int not null primary key);
save_master_pos;
......
source include/master-slave.inc;
source include/have_innodb.inc;
--echo **** On Slave ****
connection slave;
source include/have_innodb.inc;
STOP SLAVE;
--echo **** On Master ****
......@@ -69,3 +71,240 @@ query_vertical SHOW SLAVE STATUS;
connection master;
DROP TABLE t1, t2;
sync_slave_with_master;
#
# More tests for BUG#28618
#
# Case 1.
# ROW binlog format and non-transactional tables.
# Create the group of events via triggers and try to skip
# some items of that group.
#
connection master;
SET SESSION BINLOG_FORMAT=ROW;
SET AUTOCOMMIT=0;
CREATE TABLE t1 (a INT, b VARCHAR(20)) ENGINE=myisam;
CREATE TABLE t2 (a INT, b VARCHAR(20)) ENGINE=myisam;
CREATE TABLE t3 (a INT, b VARCHAR(20)) ENGINE=myisam;
INSERT INTO t1 VALUES (1,'master/slave');
INSERT INTO t2 VALUES (1,'master/slave');
INSERT INTO t3 VALUES (1,'master/slave');
DELIMITER |;
CREATE TRIGGER tr1 AFTER UPDATE on t1 FOR EACH ROW
BEGIN
INSERT INTO t2 VALUES (NEW.a,NEW.b);
DELETE FROM t2 WHERE a < NEW.a;
END|
CREATE TRIGGER tr2 AFTER INSERT on t2 FOR EACH ROW
BEGIN
UPDATE t3 SET a =2, b = 'master only';
END|
DELIMITER ;|
--echo **** On Slave ****
sync_slave_with_master;
STOP SLAVE;
source include/wait_for_slave_to_stop.inc;
--echo **** On Master ****
connection master;
UPDATE t1 SET a = 2, b = 'master only' WHERE a = 1;
DROP TRIGGER tr1;
DROP TRIGGER tr2;
INSERT INTO t1 VALUES (3,'master/slave');
INSERT INTO t2 VALUES (3,'master/slave');
INSERT INTO t3 VALUES (3,'master/slave');
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
SELECT * FROM t3 ORDER BY a;
save_master_pos;
--echo *** On Slave ***
connection slave;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
source include/wait_for_slave_to_start.inc;
sync_with_master;
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
SELECT * FROM t3 ORDER BY a;
connection master;
DROP TABLE t1, t2, t3;
sync_slave_with_master;
--echo **** Case 2: Row binlog format and transactional tables ****
# Create the transaction and try to skip some
# queries from one.
--echo *** On Master ***
connection master;
CREATE TABLE t4 (a INT, b VARCHAR(20)) ENGINE=innodb;
CREATE TABLE t5 (a INT, b VARCHAR(20)) ENGINE=innodb;
CREATE TABLE t6 (a INT, b VARCHAR(20)) ENGINE=innodb;
--echo **** On Slave ****
sync_slave_with_master;
STOP SLAVE;
source include/wait_for_slave_to_stop.inc;
--echo *** On Master ***
connection master;
BEGIN;
INSERT INTO t4 VALUES (2, 'master only');
INSERT INTO t5 VALUES (2, 'master only');
INSERT INTO t6 VALUES (2, 'master only');
COMMIT;
BEGIN;
INSERT INTO t4 VALUES (3, 'master/slave');
INSERT INTO t5 VALUES (3, 'master/slave');
INSERT INTO t6 VALUES (3, 'master/slave');
COMMIT;
SELECT * FROM t4 ORDER BY a;
SELECT * FROM t5 ORDER BY a;
SELECT * FROM t6 ORDER BY a;
save_master_pos;
--echo *** On Slave ***
connection slave;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
source include/wait_for_slave_to_start.inc;
sync_with_master;
SELECT * FROM t4 ORDER BY a;
SELECT * FROM t5 ORDER BY a;
SELECT * FROM t6 ORDER BY a;
# Test skipping two groups
--echo **** On Slave ****
connection slave;
STOP SLAVE;
source include/wait_for_slave_to_stop.inc;
--echo *** On Master ***
connection master;
BEGIN;
INSERT INTO t4 VALUES (6, 'master only');
INSERT INTO t5 VALUES (6, 'master only');
INSERT INTO t6 VALUES (6, 'master only');
COMMIT;
BEGIN;
INSERT INTO t4 VALUES (7, 'master only');
INSERT INTO t5 VALUES (7, 'master only');
INSERT INTO t6 VALUES (7, 'master only');
COMMIT;
SELECT * FROM t4 ORDER BY a;
SELECT * FROM t5 ORDER BY a;
SELECT * FROM t6 ORDER BY a;
save_master_pos;
--echo *** On Slave ***
connection slave;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=10;
START SLAVE;
source include/wait_for_slave_to_start.inc;
sync_with_master;
SELECT * FROM t4 ORDER BY a;
SELECT * FROM t5 ORDER BY a;
SELECT * FROM t6 ORDER BY a;
#
# And the same, but with autocommit = 0
#
connection slave;
STOP SLAVE;
source include/wait_for_slave_to_stop.inc;
connection master;
SET AUTOCOMMIT=0;
INSERT INTO t4 VALUES (4, 'master only');
INSERT INTO t5 VALUES (4, 'master only');
INSERT INTO t6 VALUES (4, 'master only');
COMMIT;
INSERT INTO t4 VALUES (5, 'master/slave');
INSERT INTO t5 VALUES (5, 'master/slave');
INSERT INTO t6 VALUES (5, 'master/slave');
COMMIT;
SELECT * FROM t4 ORDER BY a;
SELECT * FROM t5 ORDER BY a;
SELECT * FROM t6 ORDER BY a;
save_master_pos;
--echo *** On Slave ***
connection slave;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
source include/wait_for_slave_to_start.inc;
sync_with_master;
SELECT * FROM t4 ORDER BY a;
SELECT * FROM t5 ORDER BY a;
SELECT * FROM t6 ORDER BY a;
connection master;
DROP TABLE t4, t5, t6;
sync_slave_with_master;
--echo **** Case 3: Statement logging format and LOAD DATA with non-transactional table ****
# LOAD DATA creates two events in binary log for statement binlog format.
# Try to skip the first.
--echo *** On Master ***
connection master;
CREATE TABLE t10 (a INT, b VARCHAR(20)) ENGINE=myisam;
--echo *** On Slave ***
sync_slave_with_master;
STOP SLAVE;
source include/wait_for_slave_to_stop.inc;
--echo *** On Master ***
connection master;
SET SESSION BINLOG_FORMAT=STATEMENT;
exec cp ./suite/rpl/data/rpl_bug28618.dat $MYSQLTEST_VARDIR/tmp/;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/rpl_bug28618.dat' INTO TABLE t10 FIELDS TERMINATED BY '|';
remove_file $MYSQLTEST_VARDIR/tmp/rpl_bug28618.dat;
SELECT * FROM t10 ORDER BY a;
save_master_pos;
--echo *** On Slave ***
connection slave;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
source include/wait_for_slave_to_start.inc;
sync_with_master;
SELECT * FROM t10 ORDER BY a;
connection master;
DROP TABLE t10;
sync_slave_with_master;
......@@ -28,7 +28,7 @@ insert into t1 values(NULL,'new');
save_master_pos;
connection slave;
# wait until the slave tries to run the query, fails and aborts slave thread
wait_for_slave_to_stop;
source include/wait_for_slave_sql_error.inc;
select * from t1 order by n;
delete from t1 where n = 2;
--disable_warnings
......
--loose-debug="+d,all_errors_are_temporary_errors" --slave-transaction-retries=2
source include/master-slave.inc;
--echo **** On Master ****
connection master;
SET SESSION BINLOG_FORMAT=ROW;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
--echo **** On Slave ****
sync_slave_with_master;
SHOW STATUS LIKE 'Slave_retried_transactions';
UPDATE t1 SET a = 5, b = 47 WHERE a = 1;
SELECT * FROM t1;
--echo **** On Master ****
connection master;
UPDATE t1 SET a = 5, b = 5 WHERE a = 1;
SELECT * FROM t1;
#SHOW BINLOG EVENTS;
--echo **** On Slave ****
sync_slave_with_master;
SHOW STATUS LIKE 'Slave_retried_transactions';
SELECT * FROM t1;
source include/show_slave_status.inc;
DROP TABLE t1;
--echo **** On Master ****
connection master;
DROP TABLE t1;
......@@ -707,7 +707,7 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1060
Last_SQL_Error Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
*** Try to insert in master ****
INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2);
......
......@@ -15,8 +15,6 @@ rpl_ndb_2innodb : BUG#19227 2006-04-20 pekka pk delete apparently not r
rpl_ndb_2myisam : BUG#19227 Seems to pass currently
rpl_ndb_2other : BUG#21842 2007-08-30 tsmith test has never worked on bigendian (sol10-sparc-a, powermacg5
rpl_ndb_dd_partitions : BUG#19259 2006-04-21 rpl_ndb_dd_partitions fails on s/AMD
rpl_ndb_innodb2ndb : Bug#29549 rpl_ndb_myisam2ndb,rpl_ndb_innodb2ndb failed on Solaris for pack_length issue
rpl_ndb_myisam2ndb : Bug#29549 rpl_ndb_myisam2ndb,rpl_ndb_innodb2ndb failed on Solaris for pack_length issue
rpl_ndb_ddl : BUG#28798 2007-05-31 lars Valgrind failure in NDB
rpl_ndb_mix_innodb : BUG#28123 rpl_ndb_mix_innodb.test casue slave to core on sol10-sparc-a
rpl_ndb_ctype_ucs2_def : BUG#27404 util thd mysql_parse sig11 when mysqld default multibyte charset
......
......@@ -31,3 +31,26 @@ SELECT hex(a) FROM t1 ORDER BY a;
DROP TABLE t1;
# End of 4.1 tests
#
#Bug #30315 Character sets: insertion of euckr code value 0xa141 fails
#
create table t1 (s1 varchar(5) character set euckr);
# Insert some valid characters
insert into t1 values (0xA141);
insert into t1 values (0xA15A);
insert into t1 values (0xA161);
insert into t1 values (0xA17A);
insert into t1 values (0xA181);
insert into t1 values (0xA1FE);
# Insert some invalid characters
insert into t1 values (0xA140);
insert into t1 values (0xA15B);
insert into t1 values (0xA160);
insert into t1 values (0xA17B);
insert into t1 values (0xA180);
insert into t1 values (0xA1FF);
select hex(s1), hex(convert(s1 using utf8)) from t1 order by binary s1;
drop table t1;
--echo End of 5.0 tests
......@@ -538,4 +538,8 @@ alter table t1 convert to character set ucs2 collate ucs2_czech_ci;
select * from t1 where a like 'c%';
drop table t1;
set collation_connection=ucs2_unicode_ci;
--source include/ctype_regex.inc
set names utf8;
-- echo End for 5.0 tests
......@@ -651,6 +651,9 @@ select * from t1 where a=if(b<10,_ucs2 0x00C0,_ucs2 0x0062);
select * from t1 where a=if(b<10,_ucs2 0x0062,_ucs2 0x00C0);
drop table t1;
set collation_connection=ucs2_general_ci;
--source include/ctype_regex.inc
set names latin1;
#
# Bug#30981 CHAR(0x41 USING ucs2) doesn't add leading zero
#
......
......@@ -185,6 +185,13 @@ select * from t1 where a = 'b' and a = 'b';
select * from t1 where a = 'b' and a != 'b';
drop table t1;
#
# Testing regexp
#
set collation_connection=utf8_general_ci;
--source include/ctype_regex.inc
set names utf8;
#
# Bug #3928 regexp [[:>:]] and UTF-8
#
......
......@@ -6,28 +6,9 @@
drop table if exists t1;
--enable_warnings
create table t1 (s1 char(64),s2 char(64));
set names latin1;
--source include/ctype_regex.inc
insert into t1 values('aaa','aaa');
insert into t1 values('aaa|qqq','qqq');
insert into t1 values('gheis','^[^a-dXYZ]+$');
insert into t1 values('aab','^aa?b');
insert into t1 values('Baaan','^Ba*n');
insert into t1 values('aaa','qqq|aaa');
insert into t1 values('qqq','qqq|aaa');
insert into t1 values('bbb','qqq|aaa');
insert into t1 values('bbb','qqq');
insert into t1 values('aaa','aba');
insert into t1 values(null,'abc');
insert into t1 values('def',null);
insert into t1 values(null,null);
insert into t1 values('ghi','ghi[');
select HIGH_PRIORITY s1 regexp s2 from t1;
drop table t1;
#
# This test a bug in regexp on Alpha
......
......@@ -753,6 +753,38 @@ select * from t1;
select * from t2;
drop table t1,t2;
#
# Bug #29136 erred multi-delete on trans table does not rollback
#
# prepare
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
CREATE TABLE t1 (a int, PRIMARY KEY (a));
CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
create trigger trg_del_t2 after delete on t2 for each row
insert into t1 values (1);
insert into t1 values (1);
insert into t2 values (1),(2);
# exec cases A, B - see multi_update.test
# A. send_error() w/o send_eof() branch
--error ER_DUP_ENTRY
delete t2 from t2;
# check
select count(*) from t2 /* must be 2 as restored after rollback caused by the error */;
# cleanup bug#29136
drop table t1, t2;
#
# Testing of IFNULL
#
......
......@@ -588,6 +588,7 @@ CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
# as the test is about to see erroed queries in binlog
set @sav_binlog_format= @@session.binlog_format;
set @@session.binlog_format= mixed;
......@@ -614,5 +615,42 @@ show master status /* there must be the UPDATE query event */;
# cleanup bug#27716
drop table t1, t2;
set @@session.binlog_format= @sav_binlog_format;
#
# Bug #29136 erred multi-delete on trans table does not rollback
#
# prepare
--disable_warnings
drop table if exists t1, t2, t3;
--enable_warnings
CREATE TABLE t1 (a int, PRIMARY KEY (a));
CREATE TABLE t2 (a int, PRIMARY KEY (a));
CREATE TABLE t3 (a int, PRIMARY KEY (a)) ENGINE=MyISAM;
create trigger trg_del_t3 before delete on t3 for each row insert into t1 values (1);
insert into t2 values (1),(2);
insert into t3 values (1),(2);
reset master;
# exec cases B, A - see innodb.test
# B. send_eof() and send_error() afterward
--error ER_DUP_ENTRY
delete t3.* from t2,t3 where t2.a=t3.a;
# check
select count(*) from t1 /* must be 1 */;
select count(*) from t3 /* must be 1 */;
# cleanup bug#29136
drop table t1, t2, t3;
#
# Add further tests from here
#
--echo end of tests
......@@ -282,6 +282,15 @@ remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
#
--exec $MYSQL test -e "/*! \C latin1 */ select 1;"
#
# Bug#29323 mysql client only accetps ANSI encoded files
#
--write_file $MYSQLTEST_VARDIR/tmp/bug29323.sql
select "This is a file starting with UTF8 BOM 0xEFBBBF";
EOF
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug29323.sql 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/bug29323.sql;
--echo End of 5.0 tests
#
......
......@@ -3,7 +3,8 @@
# Simple test for the partition storage engine
# Taken fromm the select test
#
-- source include/have_partition.inc
source include/have_partition.inc;
source include/have_archive.inc;
--disable_warnings
drop table if exists t1;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -1382,6 +1382,10 @@ class Item_func_regex :public Item_bool_func
bool regex_is_const;
String prev_regexp;
DTCollation cmp_collation;
CHARSET_INFO *regex_lib_charset;
int regex_lib_flags;
String conv;
bool regcomp(bool send_error);
public:
Item_func_regex(Item *a,Item *b) :Item_bool_func(a,b),
regex_compiled(0),regex_is_const(0) {}
......
......@@ -2612,35 +2612,27 @@ typedef struct
uint level;
String *pxml; // parsed XML
uint pos[MAX_LEVEL]; // Tag position stack
uint parent; // Offset of the parent of the current node
} MY_XML_USER_DATA;
/*
Find the parent node
SYNOPSYS
Find the parent node, i.e. a tag or attrubute node on the given level.
RETURN
1 - success
0 - failure
*/
static uint xml_parent_tag(MY_XML_NODE *items, uint nitems, uint level)
static bool
append_node(String *str, MY_XML_NODE *node)
{
if (!nitems)
return 0;
MY_XML_NODE *p, *last= &items[nitems-1];
for (p= last; p >= items; p--)
{
if (p->level == level &&
(p->type == MY_XML_NODE_TAG ||
p->type == MY_XML_NODE_ATTR))
{
return p - items;
}
}
return 0;
/*
If "str" doesn't have space for a new node,
it will allocate two times more space that it has had so far.
(2*len+512) is a heuristic value,
which gave the best performance during tests.
The ideas behind this formula are:
- It allows to have a very small number of reallocs:
about 10 reallocs on a 1Mb-long XML value.
- At the same time, it avoids excessive memory use.
*/
if (str->reserve(sizeof(MY_XML_NODE), 2 * str->length() + 512))
return TRUE;
str->q_append((const char*) node, sizeof(MY_XML_NODE));
return FALSE;
}
......@@ -2662,19 +2654,17 @@ extern "C" int xml_enter(MY_XML_PARSER *st,const char *attr, size_t len);
int xml_enter(MY_XML_PARSER *st,const char *attr, size_t len)
{
MY_XML_USER_DATA *data= (MY_XML_USER_DATA*)st->user_data;
MY_XML_NODE *nodes= (MY_XML_NODE*) data->pxml->ptr();
uint numnodes= data->pxml->length() / sizeof(MY_XML_NODE);
uint parent= xml_parent_tag(nodes, numnodes, data->level - 1);
MY_XML_NODE node;
node.parent= data->parent; // Set parent for the new node to old parent
data->parent= numnodes; // Remember current node as new parent
data->pos[data->level]= numnodes;
node.level= data->level++;
node.type= st->current_node_type; // TAG or ATTR
node.beg= attr;
node.end= attr + len;
node.parent= parent;
data->pxml->append((const char*) &node, sizeof(MY_XML_NODE));
return MY_XML_OK;
return append_node(data->pxml, &node) ? MY_XML_ERROR : MY_XML_OK;
}
......@@ -2695,18 +2685,14 @@ extern "C" int xml_value(MY_XML_PARSER *st,const char *attr, size_t len);
int xml_value(MY_XML_PARSER *st,const char *attr, size_t len)
{
MY_XML_USER_DATA *data= (MY_XML_USER_DATA*)st->user_data;
MY_XML_NODE *nodes= (MY_XML_NODE*) data->pxml->ptr();
uint numnodes= data->pxml->length() / sizeof(MY_XML_NODE);
uint parent= xml_parent_tag(nodes, numnodes, data->level - 1);
MY_XML_NODE node;
node.parent= data->parent; // Set parent for the new text node to old parent
node.level= data->level;
node.type= MY_XML_NODE_TEXT;
node.beg= attr;
node.end= attr + len;
node.parent= parent;
data->pxml->append((const char*) &node, sizeof(MY_XML_NODE));
return MY_XML_OK;
return append_node(data->pxml, &node) ? MY_XML_ERROR : MY_XML_OK;
}
......@@ -2731,6 +2717,7 @@ int xml_leave(MY_XML_PARSER *st,const char *attr, size_t len)
data->level--;
MY_XML_NODE *nodes= (MY_XML_NODE*) data->pxml->ptr();
data->parent= nodes[data->parent].parent;
nodes+= data->pos[data->level];
nodes->tagend= st->cur;
......@@ -2761,6 +2748,7 @@ String *Item_xml_str_func::parse_xml(String *raw_xml, String *parsed_xml_buf)
p.flags= MY_XML_FLAG_RELATIVE_NAMES | MY_XML_FLAG_SKIP_TEXT_NORMALIZATION;
user_data.level= 0;
user_data.pxml= parsed_xml_buf;
user_data.parent= 0;
my_xml_set_enter_handler(&p, xml_enter);
my_xml_set_value_handler(&p, xml_value);
my_xml_set_leave_handler(&p, xml_leave);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -2936,7 +2936,6 @@ static int init_common_variables(const char *conf_file_name, int argc,
global_system_variables.collation_connection= default_charset_info;
global_system_variables.character_set_results= default_charset_info;
global_system_variables.character_set_client= default_charset_info;
global_system_variables.collation_connection= default_charset_info;
if (!(character_set_filesystem=
get_charset_by_csname(character_set_filesystem_name,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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