Merge dsl-hkibras1-ff5dc300-70.dhcp.inet.fi:/home/elkin/MySQL/TEAM/BARE/5.0
into dsl-hkibras1-ff5dc300-70.dhcp.inet.fi:/tmp/merge_5.0 sql/sql_insert.cc: Auto merged
This commit is contained in:
commit
f3734099d2
@ -1,106 +1,25 @@
|
|||||||
create function bug27563()
|
|
||||||
RETURNS int(11)
|
|
||||||
DETERMINISTIC
|
|
||||||
begin
|
|
||||||
select get_lock("a", 10) into @a;
|
|
||||||
return 1;
|
|
||||||
end|
|
|
||||||
create function bug27565()
|
|
||||||
RETURNS int(11)
|
|
||||||
DETERMINISTIC
|
|
||||||
begin
|
|
||||||
select a from t1 where a=1 into @a for update;
|
|
||||||
return 1;
|
|
||||||
end|
|
|
||||||
create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
|
create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
|
||||||
create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM;
|
create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM;
|
||||||
create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
|
create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
|
||||||
reset master;
|
|
||||||
select get_lock("a", 20);
|
select get_lock("a", 20);
|
||||||
get_lock("a", 20)
|
get_lock("a", 20)
|
||||||
1
|
1
|
||||||
insert into t1 values (bug27563(),1);
|
|
||||||
kill query 3;
|
|
||||||
affected rows: 1
|
|
||||||
show master status /* must be only FD event unless Bug#27563 */;
|
|
||||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
|
||||||
master-bin.000001 260
|
|
||||||
select count(*) from t1 /* must be zero unless Bug#27563 */;
|
|
||||||
count(*)
|
|
||||||
1
|
|
||||||
begin;
|
|
||||||
insert into t1 values (bug27563(),1);
|
|
||||||
kill query 3;
|
|
||||||
affected rows: 1
|
|
||||||
select count(*) from t1 /* must be zero unless Bug#27563 */;
|
|
||||||
count(*)
|
|
||||||
2
|
|
||||||
commit;
|
|
||||||
reset master;
|
reset master;
|
||||||
insert into t2 values (bug27563(),1);
|
insert into t2 values (null, null), (null, get_lock("a", 10)),(null, get_lock("a", 10));
|
||||||
kill query 3;
|
kill query 3;
|
||||||
select count(*) from t2 /* must be one */;
|
select count(*) from t2 /* must be 3 */;
|
||||||
count(*)
|
count(*)
|
||||||
1
|
3
|
||||||
show master status /* must have the insert event more to FD */;
|
|
||||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
|
||||||
master-bin.000001 225
|
|
||||||
select RELEASE_LOCK("a");
|
|
||||||
RELEASE_LOCK("a")
|
|
||||||
1
|
|
||||||
delete from t1;
|
|
||||||
delete from t2;
|
|
||||||
insert into t1 values (1,1);
|
|
||||||
insert into t2 values (1,1);
|
|
||||||
begin;
|
|
||||||
update t1 set b=0 where a=1;
|
|
||||||
update t2 set b=bug27565()-1 where a=1;
|
|
||||||
kill query 3;
|
|
||||||
commit;
|
|
||||||
Got one of the listed errors
|
|
||||||
select * from t1 /* must be: (1,0) */;
|
|
||||||
a b
|
|
||||||
1 0
|
|
||||||
select * from t2 /* must be as before: (1,1) */;
|
|
||||||
a b
|
|
||||||
1 1
|
|
||||||
delete from t3;
|
|
||||||
reset master;
|
|
||||||
begin;
|
|
||||||
update t1 set b=0 where a=1;
|
|
||||||
insert into t3 values (0,0),(1,bug27565());
|
|
||||||
kill query 3;
|
|
||||||
rollback;
|
|
||||||
Got one of the listed errors
|
|
||||||
select count(*) from t3 /* must be zero */;
|
|
||||||
count(*)
|
|
||||||
0
|
|
||||||
show master status /* nothing in binlog */;
|
|
||||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
|
||||||
master-bin.000001 98
|
|
||||||
delete from t2;
|
|
||||||
reset master;
|
|
||||||
begin;
|
|
||||||
update t1 set b=0 where a=1;
|
|
||||||
insert into t2 values (0,0),(1,bug27565()) /* non-ta t2 */;
|
|
||||||
kill query 3;
|
|
||||||
rollback;
|
|
||||||
Got one of the listed errors
|
|
||||||
select count(*) from t2 /* count must be one */;
|
|
||||||
count(*)
|
|
||||||
1
|
|
||||||
show master status /* insert into non-ta must be in binlog */;
|
|
||||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
|
||||||
master-bin.000001 247
|
|
||||||
select
|
select
|
||||||
(@a:=load_file("MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
|
(@a:=load_file("MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
|
||||||
is not null;
|
is not null;
|
||||||
(@a:=load_file("MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
|
(@a:=load_file("MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
|
||||||
is not null
|
is not null
|
||||||
1
|
1
|
||||||
select @a like "%#%error_code=1317%" /* must return 1 */;
|
select @a like "%#%error_code=0%" /* must return 1 */;
|
||||||
@a like "%#%error_code=1317%"
|
@a like "%#%error_code=0%"
|
||||||
|
1
|
||||||
|
select @a like "%insert%" /* must return 1 */;
|
||||||
|
@a like "%insert%"
|
||||||
1
|
1
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
drop function bug27563;
|
|
||||||
drop function bug27565;
|
|
||||||
|
@ -2,18 +2,52 @@
|
|||||||
|
|
||||||
###
|
###
|
||||||
### bug#22725 : incorrect killed error in binlogged query
|
### bug#22725 : incorrect killed error in binlogged query
|
||||||
### and
|
|
||||||
### Bug#27563 killing noticed in SF() stack but the error gets missed in action
|
|
||||||
### Bug#27565 killed query of SF() is not reported correctly and
|
|
||||||
###
|
###
|
||||||
|
|
||||||
connect (con1, localhost, root,,);
|
connect (con1, localhost, root,,);
|
||||||
connect (con2, localhost, root,,);
|
connect (con2, localhost, root,,);
|
||||||
|
|
||||||
# the function is *insensitive* to killing - TO FIX IN BUG#27563
|
create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
|
||||||
# the function is used in the test anyway with `TODO' left
|
create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM;
|
||||||
# to correct results afterwards
|
create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
#
|
||||||
|
# effective test for bug#22725
|
||||||
|
#
|
||||||
|
|
||||||
|
connection con1;
|
||||||
|
select get_lock("a", 20);
|
||||||
|
|
||||||
|
connection con2;
|
||||||
|
let $ID= `select connection_id()`;
|
||||||
|
reset master;
|
||||||
|
send insert into t2 values (null, null), (null, get_lock("a", 10)),(null, get_lock("a", 10));
|
||||||
|
|
||||||
|
|
||||||
|
connection con1;
|
||||||
|
eval kill query $ID;
|
||||||
|
|
||||||
|
connection con2;
|
||||||
|
--error 0,ER_QUERY_INTERRUPTED
|
||||||
|
reap;
|
||||||
|
select count(*) from t2 /* must be 3 */;
|
||||||
|
|
||||||
|
--exec $MYSQL_BINLOG --start-position=126 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
|
||||||
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||||
|
eval select
|
||||||
|
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
|
||||||
|
is not null;
|
||||||
|
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||||
|
eval select @a like "%#%error_code=0%" /* must return 1 */;
|
||||||
|
eval select @a like "%insert%" /* must return 1 */;
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# TODO: use if's block as regression test for the bugs or remove
|
||||||
|
#
|
||||||
|
if (0)
|
||||||
|
{
|
||||||
delimiter |;
|
delimiter |;
|
||||||
create function bug27563()
|
create function bug27563()
|
||||||
RETURNS int(11)
|
RETURNS int(11)
|
||||||
@ -36,9 +70,6 @@ begin
|
|||||||
end|
|
end|
|
||||||
delimiter ;|
|
delimiter ;|
|
||||||
|
|
||||||
create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
|
|
||||||
create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM;
|
|
||||||
create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
|
|
||||||
reset master;
|
reset master;
|
||||||
|
|
||||||
|
|
||||||
@ -60,7 +91,7 @@ connection con2;
|
|||||||
--enable_info
|
--enable_info
|
||||||
# todo: remove 0 return after fixing Bug#27563
|
# todo: remove 0 return after fixing Bug#27563
|
||||||
--error 0,ER_QUERY_INTERRUPTED
|
--error 0,ER_QUERY_INTERRUPTED
|
||||||
reap;
|
reap; ### pb: wrong error
|
||||||
--disable_info
|
--disable_info
|
||||||
###--replace_column 2 # 5 #
|
###--replace_column 2 # 5 #
|
||||||
### show binlog events from 98 /* nothing in binlog unless Bug#27563 */;
|
### show binlog events from 98 /* nothing in binlog unless Bug#27563 */;
|
||||||
@ -137,7 +168,7 @@ connection con2;
|
|||||||
# remove 1105 (wrong)
|
# remove 1105 (wrong)
|
||||||
#--error ER_QUERY_INTERRUPTED
|
#--error ER_QUERY_INTERRUPTED
|
||||||
--error 1105,ER_QUERY_INTERRUPTED
|
--error 1105,ER_QUERY_INTERRUPTED
|
||||||
reap;
|
reap; ### pb: wrong error
|
||||||
select * from t1 /* must be: (1,0) */;
|
select * from t1 /* must be: (1,0) */;
|
||||||
select * from t2 /* must be as before: (1,1) */;
|
select * from t2 /* must be as before: (1,1) */;
|
||||||
|
|
||||||
@ -163,7 +194,7 @@ connection con2;
|
|||||||
# remove 1105 (wrong)
|
# remove 1105 (wrong)
|
||||||
#--error ER_QUERY_INTERRUPTED
|
#--error ER_QUERY_INTERRUPTED
|
||||||
--error 1105,ER_QUERY_INTERRUPTED
|
--error 1105,ER_QUERY_INTERRUPTED
|
||||||
reap;
|
reap; ### pb: wrong error
|
||||||
select count(*) from t3 /* must be zero */;
|
select count(*) from t3 /* must be zero */;
|
||||||
show master status /* nothing in binlog */;
|
show master status /* nothing in binlog */;
|
||||||
|
|
||||||
@ -187,20 +218,16 @@ connection con2;
|
|||||||
# remove 1105 (wrong)
|
# remove 1105 (wrong)
|
||||||
#--error ER_QUERY_INTERRUPTED
|
#--error ER_QUERY_INTERRUPTED
|
||||||
--error 1105,ER_QUERY_INTERRUPTED
|
--error 1105,ER_QUERY_INTERRUPTED
|
||||||
reap;
|
reap; ### pb: wrong error
|
||||||
|
|
||||||
select count(*) from t2 /* count must be one */;
|
select count(*) from t2 /* count must be one */;
|
||||||
show master status /* insert into non-ta must be in binlog */;
|
show master status /* insert into non-ta must be in binlog */;
|
||||||
--exec $MYSQL_BINLOG --start-position=126 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
|
|
||||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
drop function bug27563;
|
||||||
eval select
|
drop function bug27565;
|
||||||
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
|
}
|
||||||
is not null;
|
|
||||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
|
||||||
eval select @a like "%#%error_code=1317%" /* must return 1 */;
|
|
||||||
system rm $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog ;
|
system rm $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog ;
|
||||||
|
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
drop function bug27563;
|
|
||||||
drop function bug27565;
|
|
||||||
|
|
||||||
|
@ -871,7 +871,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
|
|||||||
routines did not result in any error due to the KILLED. In
|
routines did not result in any error due to the KILLED. In
|
||||||
such case the flag is ignored for constructing binlog event.
|
such case the flag is ignored for constructing binlog event.
|
||||||
*/
|
*/
|
||||||
assert(thd->killed != THD::KILL_BAD_DATA || error > 0);
|
DBUG_ASSERT(thd->killed != THD::KILL_BAD_DATA || error > 0);
|
||||||
if (thd->binlog_query(THD::ROW_QUERY_TYPE,
|
if (thd->binlog_query(THD::ROW_QUERY_TYPE,
|
||||||
thd->query, thd->query_length,
|
thd->query, thd->query_length,
|
||||||
transactional_table, FALSE,
|
transactional_table, FALSE,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user