mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
bug#27571 asynchronous setting mysql_query
::error and Query_log_e::error_code
refining tests as they appear to be non-deterministic. mysql-test/suite/binlog/r/binlog_killed.result: results changed mysql-test/suite/binlog/t/binlog_killed.test: restructuring the test to deliver more deterministic outcome. order-by for update and delete did not guaratee the order of scanning. --error are masked with zero in order to catch more info if killing really will happen to be non-deterministic on some platform (witnessed something like that on dl145j) mysql-test/suite/binlog/t/binlog_killed_simulate.test: important guard added
This commit is contained in:
@ -17,8 +17,7 @@ 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) */;
|
||||
select * from t1 order by a /* must be the same as before (1,1),(2,2) */;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
@ -27,8 +26,7 @@ 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) */;
|
||||
select * from t1 order by a /* must be the same as before (1,1),(2,2) */;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
@ -41,67 +39,45 @@ 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 table t4 (a int, b int) ENGINE=MyISAM /* for killing update and delete */;
|
||||
create function bug27563(n int)
|
||||
RETURNS int(11)
|
||||
DETERMINISTIC
|
||||
begin
|
||||
if n > 1 then
|
||||
if @b > 0 then
|
||||
select get_lock("a", 10) into @a;
|
||||
else
|
||||
set @b= 1;
|
||||
end if;
|
||||
return n;
|
||||
end|
|
||||
delete from t2;
|
||||
insert into t2 values (1,1), (2,2);
|
||||
delete from t4;
|
||||
insert into t4 values (1,1), (1,1);
|
||||
reset master;
|
||||
select get_lock("a", 20);
|
||||
get_lock("a", 20)
|
||||
1
|
||||
update t2 set b=b + bug27563(b) order by a;
|
||||
set @b= 0;
|
||||
update t4 set b=b + bug27563(b);
|
||||
kill query ID;
|
||||
ERROR 70100: Query execution was interrupted
|
||||
select * from t2 /* must be (1,2), (2,2) */;
|
||||
a b
|
||||
1 2
|
||||
2 2
|
||||
must have the update event more to FD
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; update t2 set b=b + bug27563(b) order by a
|
||||
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) */;
|
||||
select * from t4 order by b /* must be (1,1), (1,2) */;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
must have the update event more to FD
|
||||
1 2
|
||||
select @b /* must be 1 at the end of a stmt calling bug27563() */;
|
||||
@b
|
||||
1
|
||||
must have the update query event more to FD
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # User var # # @`b`=0
|
||||
master-bin.000001 # Query # # use `test`; update t4 set b=b + bug27563(b)
|
||||
select
|
||||
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
|
||||
is not null;
|
||||
@ -114,6 +90,39 @@ select 0 /* must return 0 to mean the killed query is in */;
|
||||
select RELEASE_LOCK("a");
|
||||
RELEASE_LOCK("a")
|
||||
1
|
||||
delete from t4;
|
||||
insert into t4 values (1,1), (2,2);
|
||||
reset master;
|
||||
select get_lock("a", 20);
|
||||
get_lock("a", 20)
|
||||
1
|
||||
set @b= 0;
|
||||
delete from t4 where b=bug27563(1) or b=bug27563(2);
|
||||
kill query ID;
|
||||
select count(*) from t4 /* must be 1 */;
|
||||
count(*)
|
||||
1
|
||||
select @b /* must be 1 at the end of a stmt calling bug27563() */;
|
||||
@b
|
||||
1
|
||||
must have the delete query event more to FD
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # User var # # @`b`=0
|
||||
master-bin.000001 # Query # # use `test`; delete from t4 where b=bug27563(1) or b=bug27563(2)
|
||||
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 table t4;
|
||||
drop function bug27563;
|
||||
drop table t1,t2,t3;
|
||||
end of the tests
|
||||
|
Reference in New Issue
Block a user