mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge koti.dsl.inet.fi:/home/elkin/MySQL/TEAM/FIXES/5.0/bug27571_asyn_killed_flags
into koti.dsl.inet.fi:/home/elkin/MySQL/5.1-merge-bug27571 client/mysql.cc: Auto merged mysql-test/r/ctype_euckr.result: Auto merged mysql-test/r/ctype_uca.result: Auto merged mysql-test/suite/binlog/r/binlog_killed.result: Auto merged mysql-test/suite/binlog/t/binlog_killed.test: Auto merged sql/item_cmpfunc.cc: Auto merged sql/log_event.cc: Auto merged sql/log_event.h: Auto merged sql/mysqld.cc: Auto merged sql/sp_head.cc: Auto merged sql/sql_parse.cc: Auto merged strings/ctype-euc_kr.c: Auto merged mysql-test/suite/rpl/r/rpl_sp_effects.result: manual merge ul mysql-test/suite/rpl/t/rpl_sp_effects.test: manual merge sql/slave.cc: leaving for manual merge sql/sql_delete.cc: leaving for manual merge sql/sql_insert.cc: leaving for manual merge sql/sql_load.cc: leaving for manual merge sql/sql_update.cc: leaving for manual merge
This commit is contained in:
144
mysql-test/r/rpl_slave_skip.result
Normal file
144
mysql-test/r/rpl_slave_skip.result
Normal file
@ -0,0 +1,144 @@
|
||||
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 ****
|
||||
CREATE TABLE t1 (a INT, b SET('master','slave')) ENGINE=INNODB;
|
||||
CREATE TABLE t2 (a INT, b SET('master','slave')) ENGINE=MYISAM;
|
||||
==== Skipping normal transactions ====
|
||||
**** On Slave ****
|
||||
STOP SLAVE;
|
||||
**** On Master ****
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (1, 'master');
|
||||
INSERT INTO t1 VALUES (2, 'master');
|
||||
INSERT INTO t1 VALUES (3, 'master');
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (4, 'master,slave');
|
||||
INSERT INTO t1 VALUES (5, 'master,slave');
|
||||
INSERT INTO t1 VALUES (6, 'master,slave');
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
1 master
|
||||
2 master
|
||||
3 master
|
||||
4 master,slave
|
||||
5 master,slave
|
||||
6 master,slave
|
||||
**** On Slave ****
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
||||
START SLAVE;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
4 master,slave
|
||||
5 master,slave
|
||||
6 master,slave
|
||||
**** On Master ****
|
||||
DELETE FROM t1;
|
||||
==== Skipping two normal transactions ====
|
||||
**** On Slave ****
|
||||
STOP SLAVE;
|
||||
**** On Master ****
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (1, 'master');
|
||||
INSERT INTO t1 VALUES (2, 'master');
|
||||
INSERT INTO t1 VALUES (3, 'master');
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (4, 'master');
|
||||
INSERT INTO t1 VALUES (5, 'master');
|
||||
INSERT INTO t1 VALUES (6, 'master');
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (7, 'master,slave');
|
||||
INSERT INTO t1 VALUES (8, 'master,slave');
|
||||
INSERT INTO t1 VALUES (9, 'master,slave');
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
1 master
|
||||
2 master
|
||||
3 master
|
||||
4 master
|
||||
5 master
|
||||
6 master
|
||||
7 master,slave
|
||||
8 master,slave
|
||||
9 master,slave
|
||||
**** On Slave ****
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=8;
|
||||
START SLAVE;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
7 master,slave
|
||||
8 master,slave
|
||||
9 master,slave
|
||||
**** On Master ****
|
||||
DELETE FROM t1;
|
||||
==== Skipping without autocommit ====
|
||||
**** On Slave ****
|
||||
STOP SLAVE;
|
||||
**** On Master ****
|
||||
SET AUTOCOMMIT=0;
|
||||
INSERT INTO t1 VALUES (1, 'master');
|
||||
INSERT INTO t1 VALUES (2, 'master');
|
||||
INSERT INTO t1 VALUES (3, 'master');
|
||||
COMMIT;
|
||||
INSERT INTO t1 VALUES (4, 'master,slave');
|
||||
INSERT INTO t1 VALUES (5, 'master,slave');
|
||||
INSERT INTO t1 VALUES (6, 'master,slave');
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
1 master
|
||||
2 master
|
||||
3 master
|
||||
4 master,slave
|
||||
5 master,slave
|
||||
6 master,slave
|
||||
**** On Slave ****
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
||||
START SLAVE;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
4 master,slave
|
||||
5 master,slave
|
||||
6 master,slave
|
||||
==== Rollback of transaction with non-transactional change ====
|
||||
**** On Master ****
|
||||
DELETE FROM t1;
|
||||
SET AUTOCOMMIT=1;
|
||||
**** On Slave ****
|
||||
STOP SLAVE;
|
||||
**** On Master ****
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (1, '');
|
||||
INSERT INTO t2 VALUES (2, 'master');
|
||||
INSERT INTO t1 VALUES (3, '');
|
||||
ROLLBACK;
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (4, '');
|
||||
INSERT INTO t2 VALUES (5, 'master,slave');
|
||||
INSERT INTO t1 VALUES (6, '');
|
||||
ROLLBACK;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
a b
|
||||
2 master
|
||||
5 master,slave
|
||||
**** On Slave ****
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
||||
START SLAVE;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
a b
|
||||
5 master,slave
|
||||
==== Cleanup ====
|
||||
**** On Master ****
|
||||
DROP TABLE t1, t2;
|
@ -9,4 +9,110 @@ insert into t2 values (null, null), (null, get_lock("a", 10));
|
||||
select @result /* must be zero either way */;
|
||||
@result
|
||||
0
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
insert into t1 values (1,1),(2,2);
|
||||
begin;
|
||||
update t1 set b=11 where a=2;
|
||||
update t1 set b=b+10;
|
||||
kill query ID;
|
||||
rollback;
|
||||
ERROR 70100: Query execution was interrupted
|
||||
select * from t1 /* must be the same as before (1,1),(2,2) */;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
begin;
|
||||
delete from t1 where a=2;
|
||||
delete from t1 where a=2;
|
||||
kill query ID;
|
||||
rollback;
|
||||
ERROR 70100: Query execution was interrupted
|
||||
select * from t1 /* must be the same as before (1,1),(2,2) */;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
drop table if exists t4;
|
||||
create table t4 (a int, b int) engine=innodb;
|
||||
insert into t4 values (3, 3);
|
||||
begin;
|
||||
insert into t1 values (3, 3);
|
||||
begin;
|
||||
insert into t1 select * from t4 for update;
|
||||
kill query ID;
|
||||
rollback;
|
||||
ERROR 70100: Query execution was interrupted
|
||||
rollback;
|
||||
select * from t1 /* must be the same as before (1,1),(2,2) */;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
drop table t4;
|
||||
create function bug27563(n int)
|
||||
RETURNS int(11)
|
||||
DETERMINISTIC
|
||||
begin
|
||||
if n > 1 then
|
||||
select get_lock("a", 10) into @a;
|
||||
end if;
|
||||
return n;
|
||||
end|
|
||||
delete from t2;
|
||||
insert into t2 values (1,1), (2,2);
|
||||
reset master;
|
||||
select get_lock("a", 20);
|
||||
get_lock("a", 20)
|
||||
1
|
||||
update t2 set b=b + bug27563(b) order by a;
|
||||
kill query ID;
|
||||
ERROR 70100: Query execution was interrupted
|
||||
select * from t2 /* must be (1,2), (2,2) */;
|
||||
a b
|
||||
1 2
|
||||
2 2
|
||||
show master status /* must have the update event more to FD */;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000001 211
|
||||
select
|
||||
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
|
||||
is not null;
|
||||
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
|
||||
is not null
|
||||
1
|
||||
select 0 /* must return 0 to mean the killed query is in */;
|
||||
0
|
||||
0
|
||||
select RELEASE_LOCK("a");
|
||||
RELEASE_LOCK("a")
|
||||
1
|
||||
delete from t2;
|
||||
insert into t2 values (1,1), (2,2);
|
||||
reset master;
|
||||
select get_lock("a", 20);
|
||||
get_lock("a", 20)
|
||||
1
|
||||
delete from t2 where a=1 or a=bug27563(2) order by a;
|
||||
kill query ID;
|
||||
ERROR 70100: Query execution was interrupted
|
||||
select * from t2 /* must be (1,2), (2,2) */;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
show master status /* must have the update event more to FD */;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000001 98
|
||||
select
|
||||
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
|
||||
is not null;
|
||||
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
|
||||
is not null
|
||||
1
|
||||
select 0 /* must return 0 to mean the killed query is in */;
|
||||
0
|
||||
0
|
||||
select RELEASE_LOCK("a");
|
||||
RELEASE_LOCK("a")
|
||||
1
|
||||
drop function bug27563;
|
||||
drop table t1,t2,t3;
|
||||
end of the tests
|
||||
|
@ -55,194 +55,239 @@ enable_result_log;
|
||||
|
||||
select @result /* must be zero either way */;
|
||||
|
||||
# the functions are either *insensitive* to killing or killing can cause
|
||||
# strange problmes with the error propagation out of SF's stack
|
||||
# Bug#27563, Bug#27565, BUG#24971
|
||||
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
|
||||
|
||||
#
|
||||
# TODO: use if's block as regression test for the bugs or remove
|
||||
# bug#27571 asynchronous setting mysql_`query`::error and Query_log_e::error_code
|
||||
#
|
||||
if (0)
|
||||
{
|
||||
|
||||
# checking that killing inside of select loops is safe as before
|
||||
# killing after the loop can be only simulated - another test
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
insert into t1 values (1,1),(2,2);
|
||||
let $ID= `select connection_id()`;
|
||||
|
||||
#
|
||||
# simple update
|
||||
#
|
||||
connection con1;
|
||||
begin; update t1 set b=11 where a=2;
|
||||
|
||||
connection con2;
|
||||
send update t1 set b=b+10;
|
||||
|
||||
connection con1;
|
||||
--replace_result $ID ID
|
||||
eval kill query $ID;
|
||||
rollback;
|
||||
|
||||
connection con2;
|
||||
--error ER_QUERY_INTERRUPTED
|
||||
reap;
|
||||
select * from t1 /* must be the same as before (1,1),(2,2) */;
|
||||
|
||||
#
|
||||
# multi update
|
||||
# commented out as Bug #31807 multi-update,delete killing does not report with ER_QUERY_INTERRUPTED
|
||||
# in the way
|
||||
#
|
||||
# connection con1;
|
||||
# begin; update t1 set b=b+10;
|
||||
|
||||
# connection con2;
|
||||
# send update t1 as t_1,t1 as t_2 set t_1.b=11 where t_2.a=2;
|
||||
|
||||
# connection con1;
|
||||
# --replace_result $ID ID
|
||||
# eval kill query $ID;
|
||||
# rollback;
|
||||
|
||||
# disable_abort_on_error;
|
||||
|
||||
# connection con2;
|
||||
# --error HY000,ER_QUERY_INTERRUPTED
|
||||
# reap;
|
||||
# select * from t1 /* must be the same as before (1,1),(2,2) */;
|
||||
|
||||
# enable_abort_on_error;
|
||||
#
|
||||
# simple delete
|
||||
#
|
||||
connection con1;
|
||||
begin; delete from t1 where a=2;
|
||||
|
||||
connection con2;
|
||||
send delete from t1 where a=2;
|
||||
|
||||
connection con1;
|
||||
--replace_result $ID ID
|
||||
eval kill query $ID;
|
||||
rollback;
|
||||
|
||||
connection con2;
|
||||
--error ER_QUERY_INTERRUPTED
|
||||
reap;
|
||||
select * from t1 /* must be the same as before (1,1),(2,2) */;
|
||||
|
||||
#
|
||||
# multi delete
|
||||
# the same as for multi-update
|
||||
#
|
||||
# connection con1;
|
||||
# begin; delete from t1 where a=2;
|
||||
|
||||
# connection con2;
|
||||
# send delete t1 from t1 where t1.a=2;
|
||||
|
||||
# connection con1;
|
||||
# --replace_result $ID ID
|
||||
# eval kill query $ID;
|
||||
# rollback;
|
||||
|
||||
# connection con2;
|
||||
# --error 0,ER_QUERY_INTERRUPTED
|
||||
# reap;
|
||||
# select * from t1 /* must be the same as before (1,1),(2,2) */;
|
||||
#
|
||||
# insert select
|
||||
#
|
||||
connection con1;
|
||||
--disable_warnings
|
||||
drop table if exists t4;
|
||||
--enable_warnings
|
||||
create table t4 (a int, b int) engine=innodb;
|
||||
insert into t4 values (3, 3);
|
||||
begin; insert into t1 values (3, 3);
|
||||
|
||||
connection con2;
|
||||
begin;
|
||||
send insert into t1 select * from t4 for update;
|
||||
|
||||
connection con1;
|
||||
--replace_result $ID ID
|
||||
eval kill query $ID;
|
||||
rollback;
|
||||
|
||||
connection con2;
|
||||
--error ER_QUERY_INTERRUPTED
|
||||
reap;
|
||||
rollback;
|
||||
select * from t1 /* must be the same as before (1,1),(2,2) */;
|
||||
|
||||
drop table t4; # cleanup for the sub-case
|
||||
|
||||
###
|
||||
## non-ta table case: killing must be recorded in binlog
|
||||
###
|
||||
delimiter |;
|
||||
create function bug27563()
|
||||
create function bug27563(n int)
|
||||
RETURNS int(11)
|
||||
DETERMINISTIC
|
||||
begin
|
||||
select get_lock("a", 10) into @a;
|
||||
return 1;
|
||||
if n > 1 then
|
||||
select get_lock("a", 10) into @a;
|
||||
end if;
|
||||
return n;
|
||||
end|
|
||||
delimiter ;|
|
||||
|
||||
# the function is sensitive to killing requiring innodb though with wrong client error
|
||||
# TO FIX in BUG#27565; TODO: remove --error 1105 afterwards
|
||||
delimiter |;
|
||||
create function bug27565()
|
||||
RETURNS int(11)
|
||||
DETERMINISTIC
|
||||
begin
|
||||
select a from t1 where a=1 into @a for update;
|
||||
return 1;
|
||||
end|
|
||||
delimiter ;|
|
||||
#
|
||||
# update
|
||||
#
|
||||
|
||||
delete from t2;
|
||||
insert into t2 values (1,1), (2,2);
|
||||
reset master;
|
||||
|
||||
|
||||
### ta table case: killing causes rollback
|
||||
|
||||
# A. autocommit ON
|
||||
connection con1;
|
||||
select get_lock("a", 20);
|
||||
|
||||
connection con2;
|
||||
let $ID= `select connection_id()`;
|
||||
send insert into t1 values (bug27563(),1);
|
||||
send update t2 set b=b + bug27563(b) order by a;
|
||||
|
||||
connection con1;
|
||||
--replace_result $ID ID
|
||||
eval kill query $ID;
|
||||
|
||||
connection con2;
|
||||
# todo (re-record test): after bugs 27563,27565 got fixed affected rows will report zero
|
||||
--enable_info
|
||||
# todo: remove 0 return after fixing Bug#27563
|
||||
--error 0,ER_QUERY_INTERRUPTED
|
||||
reap; ### pb: wrong error
|
||||
--disable_info
|
||||
###--replace_column 2 # 5 #
|
||||
### show binlog events from 98 /* nothing in binlog unless Bug#27563 */;
|
||||
show master status /* must be only FD event unless Bug#27563 */;
|
||||
select count(*) from t1 /* must be zero unless Bug#27563 */;
|
||||
|
||||
# M. multi-statement-ta
|
||||
connection con2;
|
||||
let $ID= `select connection_id()`;
|
||||
begin;
|
||||
send insert into t1 values (bug27563(),1);
|
||||
|
||||
connection con1;
|
||||
eval kill query $ID;
|
||||
connection con2;
|
||||
# todo (re-record test): after bugs 27563,27565 got fixed affected rows will report zero
|
||||
--enable_info
|
||||
# todo: remove 0 return after fixing Bug#27563
|
||||
--error 0,ER_QUERY_INTERRUPTED
|
||||
--error ER_QUERY_INTERRUPTED
|
||||
reap;
|
||||
--disable_info
|
||||
select count(*) from t1 /* must be zero unless Bug#27563 */;
|
||||
commit;
|
||||
select * from t2 /* must be (1,2), (2,2) */;
|
||||
show master status /* must have the update event more to FD */;
|
||||
|
||||
# a proof the query is binlogged with an error
|
||||
|
||||
### non-ta table case: killing must be recorded in binlog
|
||||
|
||||
reset master;
|
||||
|
||||
connection con2;
|
||||
let $ID= `select connection_id()`;
|
||||
send insert into t2 values (bug27563(),1);
|
||||
|
||||
connection con1;
|
||||
eval kill query $ID;
|
||||
|
||||
connection con2;
|
||||
# todo: remove 0 return after fixing Bug#27563
|
||||
--error 0,ER_QUERY_INTERRUPTED
|
||||
reap;
|
||||
select count(*) from t2 /* must be one */;
|
||||
#show binlog events from 98 /* must have the insert on non-ta table */;
|
||||
show master status /* must have the insert event more to FD */;
|
||||
# the value of the error flag of KILLED_QUERY is tested further
|
||||
--exec $MYSQL_BINLOG --start-position=98 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval select
|
||||
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
|
||||
is not null;
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
let $error_code= `select @a like "%#%error_code=0%" /* must return 0*/`;
|
||||
eval select $error_code /* must return 0 to mean the killed query is in */;
|
||||
|
||||
# cleanup for the sub-case
|
||||
connection con1;
|
||||
select RELEASE_LOCK("a");
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
|
||||
|
||||
### test with effective killing of SF()
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
insert into t1 values (1,1);
|
||||
insert into t2 values (1,1);
|
||||
|
||||
#
|
||||
# Bug#27565
|
||||
# test where KILL is propagated as error to the top level
|
||||
# still another bug with the error message to the user
|
||||
# todo: fix reexecute the result file after fixing
|
||||
#
|
||||
begin; update t1 set b=0 where a=1;
|
||||
|
||||
connection con2;
|
||||
let $ID= `select connection_id()`;
|
||||
send update t2 set b=bug27565()-1 where a=1;
|
||||
|
||||
connection con1;
|
||||
eval kill query $ID;
|
||||
commit;
|
||||
|
||||
connection con2;
|
||||
# todo: fix Bug #27565 killed query of SF() is not reported correctly and
|
||||
# remove 1105 (wrong)
|
||||
#--error ER_QUERY_INTERRUPTED
|
||||
--error 1105,ER_QUERY_INTERRUPTED
|
||||
reap; ### pb: wrong error
|
||||
select * from t1 /* must be: (1,0) */;
|
||||
select * from t2 /* must be as before: (1,1) */;
|
||||
|
||||
## bug#22725 with effective and propagating killing
|
||||
#
|
||||
# top-level ta-table
|
||||
connection con1;
|
||||
delete from t3;
|
||||
reset master;
|
||||
begin; update t1 set b=0 where a=1;
|
||||
# delete
|
||||
#
|
||||
|
||||
connection con2;
|
||||
let $ID= `select connection_id()`;
|
||||
# the query won't perform completely since the function gets interrupted
|
||||
send insert into t3 values (0,0),(1,bug27565());
|
||||
|
||||
connection con1;
|
||||
eval kill query $ID;
|
||||
rollback;
|
||||
|
||||
connection con2;
|
||||
# todo: fix Bug #27565 killed query of SF() is not reported correctly and
|
||||
# remove 1105 (wrong)
|
||||
#--error ER_QUERY_INTERRUPTED
|
||||
--error 1105,ER_QUERY_INTERRUPTED
|
||||
reap; ### pb: wrong error
|
||||
select count(*) from t3 /* must be zero */;
|
||||
show master status /* nothing in binlog */;
|
||||
|
||||
# top-level non-ta-table
|
||||
connection con1;
|
||||
delete from t2;
|
||||
insert into t2 values (1,1), (2,2);
|
||||
reset master;
|
||||
begin; update t1 set b=0 where a=1;
|
||||
connection con1;
|
||||
select get_lock("a", 20);
|
||||
|
||||
connection con2;
|
||||
let $ID= `select connection_id()`;
|
||||
# the query won't perform completely since the function gets intrurrupted
|
||||
send insert into t2 values (0,0),(1,bug27565()) /* non-ta t2 */;
|
||||
send delete from t2 where a=1 or a=bug27563(2) order by a;
|
||||
|
||||
connection con1;
|
||||
--replace_result $ID ID
|
||||
eval kill query $ID;
|
||||
rollback;
|
||||
|
||||
connection con2;
|
||||
# todo: fix Bug #27565 killed query of SF() is not reported correctly and
|
||||
# remove 1105 (wrong)
|
||||
#--error ER_QUERY_INTERRUPTED
|
||||
--error 1105,ER_QUERY_INTERRUPTED
|
||||
reap; ### pb: wrong error
|
||||
--error ER_QUERY_INTERRUPTED
|
||||
reap;
|
||||
select * from t2 /* must be (1,2), (2,2) */;
|
||||
show master status /* must have the update event more to FD */;
|
||||
|
||||
select count(*) from t2 /* count must be one */;
|
||||
show master status /* insert into non-ta must be in binlog */;
|
||||
# a proof the query is binlogged with an error
|
||||
|
||||
--exec $MYSQL_BINLOG --start-position=98 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval select
|
||||
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
|
||||
is not null;
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
let $error_code= `select @a like "%#%error_code=0%" /* must return 0*/`;
|
||||
eval select $error_code /* must return 0 to mean the killed query is in */;
|
||||
|
||||
# cleanup for the sub-case
|
||||
connection con1;
|
||||
select RELEASE_LOCK("a");
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
|
||||
|
||||
#
|
||||
# load data - see simulation tests
|
||||
#
|
||||
|
||||
|
||||
# bug#27571 cleanup
|
||||
|
||||
drop function bug27563;
|
||||
drop function bug27565;
|
||||
}
|
||||
|
||||
system rm $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog ;
|
||||
|
||||
#
|
||||
# common cleanup
|
||||
#
|
||||
|
||||
drop table t1,t2,t3;
|
||||
|
||||
--echo end of the tests
|
||||
|
@ -201,6 +201,10 @@ sync_slave_with_master;
|
||||
connection slave;
|
||||
SELECT 'slave', a FROM t1 ORDER BY a;
|
||||
|
||||
#
|
||||
# cleanup
|
||||
#
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
drop function f1;
|
||||
@ -208,4 +212,50 @@ drop function f2;
|
||||
drop procedure p1;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# bug#26199 Replication Failure on Slave when using stored procs
|
||||
# with bit-type parameters
|
||||
|
||||
connection master;
|
||||
|
||||
create table t2 (b BIT(7));
|
||||
delimiter //;
|
||||
create procedure sp_bug26199(bitvalue BIT(7))
|
||||
begin
|
||||
insert into t2 set b = bitvalue;
|
||||
end //
|
||||
|
||||
create function sf_bug26199(b BIT(7)) returns int
|
||||
begin
|
||||
insert into t2 values(b);
|
||||
return 0;
|
||||
end//
|
||||
|
||||
DELIMITER ;//
|
||||
|
||||
|
||||
|
||||
call sp_bug26199(b'1110');
|
||||
call sp_bug26199('\0');
|
||||
select sf_bug26199(b'1111111');
|
||||
select sf_bug26199(b'101111111');
|
||||
select sf_bug26199('\'');
|
||||
select hex(b) from t2;
|
||||
|
||||
sync_slave_with_master;
|
||||
#connection slave;
|
||||
select hex(b) from t2;
|
||||
|
||||
#
|
||||
# cleanup bug#26199
|
||||
#
|
||||
connection master;
|
||||
drop table t2;
|
||||
drop procedure sp_bug26199;
|
||||
drop function sf_bug26199;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
SET GLOBAL log_bin_trust_function_creators = 0;
|
||||
|
||||
--echo end of the tests
|
||||
|
1
mysql-test/t/binlog_killed_bug27571-master.opt
Normal file
1
mysql-test/t/binlog_killed_bug27571-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--loose-debug=d,stop_after_row_loop_done
|
68
mysql-test/t/binlog_killed_bug27571.test
Normal file
68
mysql-test/t/binlog_killed_bug27571.test
Normal file
@ -0,0 +1,68 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_log_bin.inc
|
||||
|
||||
#
|
||||
# bug#27571 asynchronous setting mysql_`query`::error and Query_log_e::error_code
|
||||
#
|
||||
# Checking that if killing happens inbetween of the end of rows loop and
|
||||
# recording into binlog that will not lead to recording any error incl
|
||||
# the killed error.
|
||||
#
|
||||
|
||||
connect (looser, localhost, root,,);
|
||||
connect (killer, localhost, root,,);
|
||||
|
||||
create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
|
||||
|
||||
delete from t1;
|
||||
insert into t1 values (1,1),(2,2);
|
||||
reset master;
|
||||
|
||||
connection looser;
|
||||
let $ID= `select connection_id()`;
|
||||
send update t1 set b=11 where a=2;
|
||||
|
||||
connection killer;
|
||||
sleep 1; # let 1 second for the update to get to the sleeping point
|
||||
--replace_result $ID ID
|
||||
eval kill query $ID;
|
||||
|
||||
connection looser;
|
||||
--error 0 # zero even though the query must be got killed while it was sleepin for 5 secs
|
||||
reap;
|
||||
|
||||
#
|
||||
# this is another possible artifact. The killed error was not caught
|
||||
# as that is logical as killing was not effective:
|
||||
# data are ok and well as binlog event is without killed error (further).
|
||||
# The reason of the following `show error' is to prove that
|
||||
# killing simulation was effective
|
||||
#
|
||||
show errors;
|
||||
|
||||
connection killer;
|
||||
|
||||
# nothing is rolled back
|
||||
|
||||
select * from t1 where a=2 /* must be 11 */;
|
||||
|
||||
# a proof the query is binlogged with an error
|
||||
|
||||
--exec $MYSQL_BINLOG --start-position=98 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval select
|
||||
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
|
||||
is not null;
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
let $error_code= `select @a like "%#%error_code=0%"`;
|
||||
|
||||
eval select $error_code /* must return 1*/;
|
||||
|
||||
#
|
||||
# cleanup
|
||||
#
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo end of the tests
|
1
mysql-test/t/binlog_killed_simulate-master.opt
Normal file
1
mysql-test/t/binlog_killed_simulate-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--loose-debug=d,simulate_kill_bug27571
|
65
mysql-test/t/binlog_killed_simulate.test
Normal file
65
mysql-test/t/binlog_killed_simulate.test
Normal file
@ -0,0 +1,65 @@
|
||||
#
|
||||
# bug#27571 asynchronous setting mysql_$query()'s local error and
|
||||
# Query_log_event::error_code
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Checking that killing upon successful row-loop does not affect binlogging
|
||||
#
|
||||
|
||||
create table t1 (a int) engine=MyISAM;
|
||||
insert into t1 set a=1;
|
||||
reset master;
|
||||
|
||||
update t1 set a=2 /* will be "killed" after work has been done */;
|
||||
|
||||
# a proof the query is binlogged with no error
|
||||
|
||||
--exec $MYSQL_BINLOG --start-position=98 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval select
|
||||
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
|
||||
is not null;
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
let $error_code= `select @a like "%#%error_code=0%" /* must return 1 */`;
|
||||
eval select $error_code /* must return 1 as query completed before got killed*/;
|
||||
|
||||
# cleanup for the sub-case
|
||||
system rm $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
|
||||
|
||||
|
||||
#
|
||||
# Checking that killing inside of row-loop for LOAD DATA into
|
||||
# non-transactional table affects binlogging
|
||||
#
|
||||
|
||||
create table t2 (a int, b int) ENGINE=MyISAM;
|
||||
reset master;
|
||||
--error ER_QUERY_INTERRUPTED
|
||||
load data infile '../std_data_ln/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */;
|
||||
|
||||
|
||||
# a proof the query is binlogged with an error
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
--exec $MYSQL_BINLOG --start-position=98 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval select
|
||||
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
|
||||
is not null;
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
let $error_code= `select @a like "%#%error_code=0%" /* must return 0*/`;
|
||||
eval select $error_code /* must return 0 to mean the killed query is in */;
|
||||
|
||||
# cleanup for the sub-case
|
||||
system rm $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
|
||||
|
||||
|
||||
drop table t1,t2;
|
||||
|
||||
--echo end of the tests
|
1
mysql-test/t/rpl_slave_skip-slave.opt
Normal file
1
mysql-test/t/rpl_slave_skip-slave.opt
Normal file
@ -0,0 +1 @@
|
||||
--innodb
|
203
mysql-test/t/rpl_slave_skip.test
Normal file
203
mysql-test/t/rpl_slave_skip.test
Normal file
@ -0,0 +1,203 @@
|
||||
source include/have_innodb.inc;
|
||||
source include/master-slave.inc;
|
||||
|
||||
# This test is for checking that the use of SQL_SLAVE_SKIP_COUNTER
|
||||
# behaves as expected, i.e., that it is guaranteed to skip an entire
|
||||
# group and not start executing in the middle of a transaction.
|
||||
|
||||
# We are checking the correct behaviour when using both a
|
||||
# transactional and non-transactional table. The non-transactional
|
||||
# table comes into play when rolling back a transaction containing a
|
||||
# write to this table. In that case, the transaction should still be
|
||||
# written to the binary log, and the slave will apply it and then roll
|
||||
# it back to get the non-transactional change into the table.
|
||||
|
||||
--echo **** On Master ****
|
||||
CREATE TABLE t1 (a INT, b SET('master','slave')) ENGINE=INNODB;
|
||||
CREATE TABLE t2 (a INT, b SET('master','slave')) ENGINE=MYISAM;
|
||||
|
||||
--echo ==== Skipping normal transactions ====
|
||||
|
||||
--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 t1 VALUES (1, 'master');
|
||||
INSERT INTO t1 VALUES (2, 'master');
|
||||
INSERT INTO t1 VALUES (3, 'master');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (4, 'master,slave');
|
||||
INSERT INTO t1 VALUES (5, 'master,slave');
|
||||
INSERT INTO t1 VALUES (6, 'master,slave');
|
||||
COMMIT;
|
||||
|
||||
save_master_pos;
|
||||
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
# This will skip a begin event and the first INSERT of the
|
||||
# transaction, and it should keep skipping until it has reached the
|
||||
# transaction terminator.
|
||||
|
||||
--echo **** On Slave ****
|
||||
connection slave;
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
||||
START SLAVE;
|
||||
source include/wait_for_slave_to_start.inc;
|
||||
sync_with_master;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
DELETE FROM t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo ==== Skipping two normal transactions ====
|
||||
|
||||
--echo **** On Slave ****
|
||||
connection slave;
|
||||
STOP SLAVE;
|
||||
source include/wait_for_slave_to_stop.inc;
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (1, 'master');
|
||||
INSERT INTO t1 VALUES (2, 'master');
|
||||
INSERT INTO t1 VALUES (3, 'master');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (4, 'master');
|
||||
INSERT INTO t1 VALUES (5, 'master');
|
||||
INSERT INTO t1 VALUES (6, 'master');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (7, 'master,slave');
|
||||
INSERT INTO t1 VALUES (8, 'master,slave');
|
||||
INSERT INTO t1 VALUES (9, 'master,slave');
|
||||
COMMIT;
|
||||
|
||||
save_master_pos;
|
||||
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
# This will skip a begin event and the first INSERT of the
|
||||
# transaction, and it should keep skipping until it has reached the
|
||||
# transaction terminator.
|
||||
|
||||
--echo **** On Slave ****
|
||||
connection slave;
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=8;
|
||||
START SLAVE;
|
||||
source include/wait_for_slave_to_start.inc;
|
||||
sync_with_master;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
DELETE FROM t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo ==== Skipping without autocommit ====
|
||||
|
||||
# Testing without using autocommit instead. It should still write a
|
||||
# BEGIN event, so the behaviour should be the same
|
||||
|
||||
--echo **** On Slave ****
|
||||
connection slave;
|
||||
STOP SLAVE;
|
||||
source include/wait_for_slave_to_stop.inc;
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
SET AUTOCOMMIT=0;
|
||||
|
||||
INSERT INTO t1 VALUES (1, 'master');
|
||||
INSERT INTO t1 VALUES (2, 'master');
|
||||
INSERT INTO t1 VALUES (3, 'master');
|
||||
COMMIT;
|
||||
|
||||
INSERT INTO t1 VALUES (4, 'master,slave');
|
||||
INSERT INTO t1 VALUES (5, 'master,slave');
|
||||
INSERT INTO t1 VALUES (6, 'master,slave');
|
||||
COMMIT;
|
||||
|
||||
save_master_pos;
|
||||
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
# This will skip a begin event and the first INSERT of the
|
||||
# transaction, and it should keep skipping until it has reached the
|
||||
# transaction terminator.
|
||||
|
||||
--echo **** On Slave ****
|
||||
connection slave;
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
||||
START SLAVE;
|
||||
source include/wait_for_slave_to_start.inc;
|
||||
sync_with_master;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
# Testing with a non-transactional table in the transaction. This will
|
||||
# log a ROLLBACK as a transaction terminator, which is a normal Query
|
||||
# log event.
|
||||
|
||||
--echo ==== Rollback of transaction with non-transactional change ====
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
DELETE FROM t1;
|
||||
SET AUTOCOMMIT=1;
|
||||
|
||||
--echo **** On Slave ****
|
||||
sync_slave_with_master;
|
||||
STOP SLAVE;
|
||||
source include/wait_for_slave_to_stop.inc;
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
disable_warnings;
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (1, '');
|
||||
INSERT INTO t2 VALUES (2, 'master');
|
||||
INSERT INTO t1 VALUES (3, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (4, '');
|
||||
INSERT INTO t2 VALUES (5, 'master,slave');
|
||||
INSERT INTO t1 VALUES (6, '');
|
||||
ROLLBACK;
|
||||
enable_warnings;
|
||||
|
||||
save_master_pos;
|
||||
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
--echo **** On Slave ****
|
||||
connection slave;
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
||||
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;
|
||||
|
||||
--echo ==== Cleanup ====
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
DROP TABLE t1, t2;
|
||||
sync_slave_with_master;
|
Reference in New Issue
Block a user