mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
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.
This commit is contained in:
@ -610,49 +610,4 @@ c1 c2 c3
|
||||
2 1 4
|
||||
2 2 5
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash
|
||||
#
|
||||
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (c2 INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
|
||||
INSERT INTO t2 values (2);
|
||||
DELETE FROM t1 WHERE c1 IN (select c2 from t2);
|
||||
select * from t1;
|
||||
c1
|
||||
1
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
truncate t1;
|
||||
truncate t2;
|
||||
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
|
||||
INSERT INTO t2 values (2);
|
||||
check sj optimization with order-by
|
||||
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using filesort
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 1.00 100.00 16.67 Using where; FirstMatch(t1)
|
||||
select * from t1;
|
||||
c1
|
||||
1
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
truncate t2;
|
||||
INSERT INTO t2 values (3);
|
||||
disallows sj optimization
|
||||
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1 limit 1;
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 1.00 100.00 100.00 Using where; Using filesort
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1 1.00 100.00 20.00 Using where
|
||||
select * from t1;
|
||||
c1
|
||||
1
|
||||
4
|
||||
5
|
||||
6
|
||||
DROP TABLE t1, t2;
|
||||
End of 11.1 tests
|
||||
|
@ -667,31 +667,4 @@ select *from t1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash
|
||||
--echo #
|
||||
--source include/have_innodb.inc
|
||||
|
||||
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (c2 INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
|
||||
INSERT INTO t2 values (2);
|
||||
|
||||
DELETE FROM t1 WHERE c1 IN (select c2 from t2);
|
||||
select * from t1;
|
||||
truncate t1;
|
||||
truncate t2;
|
||||
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
|
||||
INSERT INTO t2 values (2);
|
||||
--echo check sj optimization with order-by
|
||||
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
|
||||
select * from t1;
|
||||
truncate t2;
|
||||
INSERT INTO t2 values (3);
|
||||
--echo disallows sj optimization
|
||||
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1 limit 1;
|
||||
select * from t1;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo End of 11.1 tests
|
||||
|
@ -24,3 +24,49 @@ SELECT * FROM t1;
|
||||
c1
|
||||
SET sort_buffer_size=@save_sort_buffer_size;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash
|
||||
#
|
||||
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (c2 INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
|
||||
INSERT INTO t2 values (2);
|
||||
DELETE FROM t1 WHERE c1 IN (select c2 from t2);
|
||||
select * from t1;
|
||||
c1
|
||||
1
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
truncate t1;
|
||||
truncate t2;
|
||||
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
|
||||
INSERT INTO t2 values (2);
|
||||
check sj optimization with order-by
|
||||
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using filesort
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 1.00 100.00 16.67 Using where; FirstMatch(t1)
|
||||
select * from t1;
|
||||
c1
|
||||
1
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
truncate t2;
|
||||
INSERT INTO t2 values (3);
|
||||
disallows sj optimization
|
||||
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1 limit 1;
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 1.00 100.00 100.00 Using where; Using filesort
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1 1.00 100.00 20.00 Using where
|
||||
select * from t1;
|
||||
c1
|
||||
1
|
||||
4
|
||||
5
|
||||
6
|
||||
DROP TABLE t1, t2;
|
||||
End of 11.1 tests
|
||||
|
@ -1,6 +1,8 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_sequence.inc
|
||||
|
||||
--source include/innodb_stable_estimates.inc
|
||||
|
||||
--echo # Tests for delete with INNODB
|
||||
|
||||
--echo #
|
||||
@ -20,3 +22,31 @@ SELECT * FROM t1;
|
||||
|
||||
SET sort_buffer_size=@save_sort_buffer_size;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash
|
||||
--echo #
|
||||
--source include/have_innodb.inc
|
||||
|
||||
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (c2 INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
|
||||
INSERT INTO t2 values (2);
|
||||
|
||||
DELETE FROM t1 WHERE c1 IN (select c2 from t2);
|
||||
select * from t1;
|
||||
truncate t1;
|
||||
truncate t2;
|
||||
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
|
||||
INSERT INTO t2 values (2);
|
||||
--echo check sj optimization with order-by
|
||||
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
|
||||
select * from t1;
|
||||
truncate t2;
|
||||
INSERT INTO t2 values (3);
|
||||
--echo disallows sj optimization
|
||||
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1 limit 1;
|
||||
select * from t1;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
--echo End of 11.1 tests
|
||||
|
Reference in New Issue
Block a user