1
create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
2
create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM;
3
create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
4
select get_lock("a", 20);
8
insert into t2 values (null, null), (null, get_lock("a", 10));
9
select @result /* must be zero either way */;
12
select RELEASE_LOCK("a");
17
insert into t1 values (1,1),(2,2);
19
update t1 set b=11 where a=2;
25
select * from t1 order by a /* must be the same as before (1,1),(2,2) */;
30
delete from t1 where a=2;
32
delete from t1 where a=2;
36
select * from t1 order by a /* must be the same as before (1,1),(2,2) */;
40
drop table if exists t4;
41
create table t4 (a int, b int) engine=innodb;
42
insert into t4 values (3, 3);
44
insert into t1 values (3, 3);
46
insert into t1 select * from t4 for update;
50
select * from t1 /* must be the same as before (1,1),(2,2) */;
55
create table t4 (a int, b int) ENGINE=MyISAM /* for killing update and delete */;
56
create function bug27563(n int)
61
select get_lock("a", 20) into @a;
68
insert into t4 values (1,1), (1,1);
70
select get_lock("a", 20);
74
update t4 set b=b + bug27563(b);
75
select count(*) FROM INFORMATION_SCHEMA.PROCESSLIST where state='User lock';
79
ERROR 70100: Query execution was interrupted
80
select * from t4 order by b /* must be (1,1), (1,2) */;
84
select @b /* must be 1 at the end of a stmt calling bug27563() */;
87
must have the update query event more to FD
88
show binlog events from <binlog_start>;
89
Log_name Pos Event_type Server_id End_log_pos Info
90
master-bin.000001 # User var # # @`b`=0
91
master-bin.000001 # Query # # use `test`; update t4 set b=b + bug27563(b)
93
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
95
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
98
select 0 /* must return 0 to mean the killed query is in */;
101
select RELEASE_LOCK("a");
105
insert into t4 values (1,1), (2,2);
107
select get_lock("a", 20);
111
delete from t4 where b=bug27563(1) or b=bug27563(2);
112
select count(*) FROM INFORMATION_SCHEMA.PROCESSLIST where state='User lock';
116
ERROR 70100: Query execution was interrupted
117
select count(*) from t4 /* must be 1 */;
120
select @b /* must be 1 at the end of a stmt calling bug27563() */;
123
must have the delete query event more to FD
124
show binlog events from <binlog_start>;
125
Log_name Pos Event_type Server_id End_log_pos Info
126
master-bin.000001 # User var # # @`b`=0
127
master-bin.000001 # Query # # use `test`; delete from t4 where b=bug27563(1) or b=bug27563(2)
129
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
131
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
134
select 0 /* must return 0 to mean the killed query is in */;
137
select RELEASE_LOCK("a");
141
drop function bug27563;