1--source include/have_debug.inc
2--source include/have_debug_sync.inc
3--source include/count_sessions.inc
4
5--echo #
6--echo # MDEV-22761 KILL QUERY during rowid_filter, crashes
7--echo #
8
9create table t0(a int);
10insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
11
12create table t1(a int);
13insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
14
15# 100 rows
16create table t2(a int);
17insert into t2 select A.a + B.a* 10 from t0 A, t0 B;
18
19# 10K rows
20CREATE TABLE t3 (
21  key1 int ,
22  key2 int,
23  filler varchar(255),
24  KEY (key1),
25  KEY (key2)
26);
27select engine from information_schema.tables
28where table_schema=database() and table_name='t3';
29
30insert into t3
31select
32  A.a,
33  A.a,
34  'filler-data-filler-data'
35from
36  t0 A, t1 B;
37
38analyze table t2,t3;
39
40explain
41select * from t2, t3
42where
43  t3.key1=t2.a and t3.key2 in (2,3);
44
45let $target_id= `select connection_id()`;
46
47set debug_sync='handler_rowid_filter_check SIGNAL at_rowid_filter_check WAIT_FOR go';
48send
49select * from t2, t3
50where
51  t3.key1=t2.a and t3.key2 in (2,3);
52
53connect (con1, localhost, root,,);
54connection con1;
55set debug_sync='now WAIT_FOR at_rowid_filter_check';
56evalp kill query $target_id;
57set debug_sync='now SIGNAL go';
58
59connection default;
60disconnect con1;
61
62--error ER_QUERY_INTERRUPTED
63reap;
64set debug_sync='RESET';
65
66drop table t0,t1,t2,t3;
67--source include/wait_until_count_sessions.inc
68
69