Skip to content

Commit 50e02a3

Browse files
committed
Fix and stabilize testcase for MDEV-32212
- Move it from delete.test to delete_innodb.test - Use --source include/innodb_stable_estimates.inc to make it predicatable.
1 parent 2edc1ad commit 50e02a3

File tree

4 files changed

+76
-72
lines changed

4 files changed

+76
-72
lines changed

mysql-test/main/delete.result

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -610,49 +610,4 @@ c1 c2 c3
610610
2 1 4
611611
2 2 5
612612
drop table t1;
613-
#
614-
# MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash
615-
#
616-
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
617-
CREATE TABLE t2 (c2 INT) ENGINE=InnoDB;
618-
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
619-
INSERT INTO t2 values (2);
620-
DELETE FROM t1 WHERE c1 IN (select c2 from t2);
621-
select * from t1;
622-
c1
623-
1
624-
3
625-
4
626-
5
627-
6
628-
truncate t1;
629-
truncate t2;
630-
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
631-
INSERT INTO t2 values (2);
632-
check sj optimization with order-by
633-
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
634-
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
635-
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using filesort
636-
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 1.00 100.00 16.67 Using where; FirstMatch(t1)
637-
select * from t1;
638-
c1
639-
1
640-
3
641-
4
642-
5
643-
6
644-
truncate t2;
645-
INSERT INTO t2 values (3);
646-
disallows sj optimization
647-
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1 limit 1;
648-
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
649-
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 1.00 100.00 100.00 Using where; Using filesort
650-
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1 1.00 100.00 20.00 Using where
651-
select * from t1;
652-
c1
653-
1
654-
4
655-
5
656-
6
657-
DROP TABLE t1, t2;
658613
End of 11.1 tests

mysql-test/main/delete.test

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -667,31 +667,4 @@ select *from t1;
667667

668668
drop table t1;
669669

670-
--echo #
671-
--echo # MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash
672-
--echo #
673-
--source include/have_innodb.inc
674-
675-
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
676-
CREATE TABLE t2 (c2 INT) ENGINE=InnoDB;
677-
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
678-
INSERT INTO t2 values (2);
679-
680-
DELETE FROM t1 WHERE c1 IN (select c2 from t2);
681-
select * from t1;
682-
truncate t1;
683-
truncate t2;
684-
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
685-
INSERT INTO t2 values (2);
686-
--echo check sj optimization with order-by
687-
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
688-
select * from t1;
689-
truncate t2;
690-
INSERT INTO t2 values (3);
691-
--echo disallows sj optimization
692-
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1 limit 1;
693-
select * from t1;
694-
695-
DROP TABLE t1, t2;
696-
697670
--echo End of 11.1 tests

mysql-test/main/delete_innodb.result

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,49 @@ SELECT * FROM t1;
2424
c1
2525
SET sort_buffer_size=@save_sort_buffer_size;
2626
DROP TABLE t1;
27+
#
28+
# MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash
29+
#
30+
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
31+
CREATE TABLE t2 (c2 INT) ENGINE=InnoDB;
32+
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
33+
INSERT INTO t2 values (2);
34+
DELETE FROM t1 WHERE c1 IN (select c2 from t2);
35+
select * from t1;
36+
c1
37+
1
38+
3
39+
4
40+
5
41+
6
42+
truncate t1;
43+
truncate t2;
44+
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
45+
INSERT INTO t2 values (2);
46+
check sj optimization with order-by
47+
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
48+
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
49+
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using filesort
50+
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 1.00 100.00 16.67 Using where; FirstMatch(t1)
51+
select * from t1;
52+
c1
53+
1
54+
3
55+
4
56+
5
57+
6
58+
truncate t2;
59+
INSERT INTO t2 values (3);
60+
disallows sj optimization
61+
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1 limit 1;
62+
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
63+
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 1.00 100.00 100.00 Using where; Using filesort
64+
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1 1.00 100.00 20.00 Using where
65+
select * from t1;
66+
c1
67+
1
68+
4
69+
5
70+
6
71+
DROP TABLE t1, t2;
72+
End of 11.1 tests

mysql-test/main/delete_innodb.test

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
--source include/have_innodb.inc
22
--source include/have_sequence.inc
33

4+
--source include/innodb_stable_estimates.inc
5+
46
--echo # Tests for delete with INNODB
57

68
--echo #
@@ -20,3 +22,31 @@ SELECT * FROM t1;
2022

2123
SET sort_buffer_size=@save_sort_buffer_size;
2224
DROP TABLE t1;
25+
26+
--echo #
27+
--echo # MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash
28+
--echo #
29+
--source include/have_innodb.inc
30+
31+
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
32+
CREATE TABLE t2 (c2 INT) ENGINE=InnoDB;
33+
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
34+
INSERT INTO t2 values (2);
35+
36+
DELETE FROM t1 WHERE c1 IN (select c2 from t2);
37+
select * from t1;
38+
truncate t1;
39+
truncate t2;
40+
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
41+
INSERT INTO t2 values (2);
42+
--echo check sj optimization with order-by
43+
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
44+
select * from t1;
45+
truncate t2;
46+
INSERT INTO t2 values (3);
47+
--echo disallows sj optimization
48+
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1 limit 1;
49+
select * from t1;
50+
51+
DROP TABLE t1, t2;
52+
--echo End of 11.1 tests

0 commit comments

Comments
 (0)