1+ set default_storage_engine=innodb;
2+ #
3+ # MDEV-22761 KILL QUERY during rowid_filter, crashes
4+ #
5+ create table t0(a int);
6+ insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
7+ create table t1(a int);
8+ insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
9+ create table t2(a int);
10+ insert into t2 select A.a + B.a* 10 from t0 A, t0 B;
11+ CREATE TABLE t3 (
12+ key1 int ,
13+ key2 int,
14+ filler varchar(255),
15+ KEY (key1),
16+ KEY (key2)
17+ );
18+ select engine from information_schema.tables
19+ where table_schema=database() and table_name='t3';
20+ engine
21+ InnoDB
22+ insert into t3
23+ select
24+ A.a,
25+ A.a,
26+ 'filler-data-filler-data'
27+ from
28+ t0 A, t1 B;
29+ analyze table t2,t3;
30+ Table Op Msg_type Msg_text
31+ test.t2 analyze status Engine-independent statistics collected
32+ test.t2 analyze status OK
33+ test.t3 analyze status Engine-independent statistics collected
34+ test.t3 analyze status OK
35+ explain
36+ select * from t2, t3
37+ where
38+ t3.key1=t2.a and t3.key2 in (2,3);
39+ id select_type table type possible_keys key key_len ref rows Extra
40+ 1 SIMPLE t2 ALL NULL NULL NULL NULL 100 Using where
41+ 1 SIMPLE t3 ref|filter key1,key2 key1|key2 5|5 test.t2.a 1000 (20%) Using where; Using rowid filter
42+ set debug_sync='handler_rowid_filter_check SIGNAL at_rowid_filter_check WAIT_FOR go';
43+ select * from t2, t3
44+ where
45+ t3.key1=t2.a and t3.key2 in (2,3);
46+ connect con1, localhost, root,,;
47+ connection con1;
48+ set debug_sync='now WAIT_FOR at_rowid_filter_check';
49+ kill query $target_id;
50+ set debug_sync='now SIGNAL go';
51+ connection default;
52+ disconnect con1;
53+ ERROR 70100: Query execution was interrupted
54+ set debug_sync='RESET';
55+ drop table t0,t1,t2,t3;
56+ set default_storage_engine=default;
157set @save_optimizer_switch= @@optimizer_switch;
258set @save_use_stat_tables= @@use_stat_tables;
359set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
@@ -6,18 +62,19 @@ set optimizer_use_condition_selectivity=2;
662set optimizer_switch='rowid_filter=on';
763#
864# MDEV-22761 KILL QUERY during rowid_filter, crashes
65+ # (The smaller testcase)
966#
1067CREATE TABLE t1 (a INT, b INT, INDEX(a), INDEX(b)) ENGINE=InnoDB;
1168INSERT INTO t1 VALUES (0,0),(1,0),(-1,1), (-2,1), (-2,3), (-3,4), (-2,4);
12- set debug_sync='row_search_pre_rowid_filter_check SIGNAL killme WAIT_FOR go';
69+ set debug_sync='handler_rowid_filter_check SIGNAL killme WAIT_FOR go';
1370SELECT * FROM t1 WHERE a > 0 AND b=0;
1471connect con1, localhost, root,,;
1572connection con1;
1673set debug_sync='now WAIT_FOR killme';
1774kill query @id;
1875set debug_sync='now SIGNAL go';
1976connection default;
20- a b
77+ ERROR 70100: Query execution was interrupted
2178set debug_sync='RESET';
2279disconnect con1;
2380drop table t1;
0 commit comments