| 1 |
--source include/have_innodb.inc |
| 2 |
## |
| 3 |
# Bug #56228: dropping tables from within an active statement crashes server |
| 4 |
# |
| 5 |
|
| 6 |
# This test used to use TEMPORARY TABLE, which before MySQL 5.7 or |
| 7 |
# MariaDB Server 10.2 were covered by InnoDB locks. |
| 8 |
# In MariaDB Server 10.6, the locking and logging was corrected for Atomic DDL. |
| 9 |
# Hence, even if we tweaked create_table_info_t::innobase_table_flags() |
| 10 |
# so that TEMPORARY TABLE are created as persistent tables, |
| 11 |
# the DROP TEMPORARY TABLE statement inside the function would |
| 12 |
# fail due to HA_ERR_LOCK_WAIT_TIMEOUT, instead of breaking locks |
| 13 |
# like it used to do before MDEV-26603 and possibly other changes. |
| 14 |
CREATE TABLE t1_56228( |
| 15 |
c1 iNT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; |
| 16 |
CREATE TABLE t2_56228( |
| 17 |
c1 iNT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; |
| 18 |
|
| 19 |
DELIMITER //; |
| 20 |
|
| 21 |
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG |
| 22 |
CREATE FUNCTION bug56228() RETURNS INT DETERMINISTIC |
| 23 |
BEGIN |
| 24 |
INSERT INTO t1_56228 VALUES(NULL); |
| 25 |
INSERT INTO t2_56228 VALUES(NULL); |
| 26 |
INSERT INTO t1_56228 VALUES(NULL); |
| 27 |
INSERT INTO t2_56228 VALUES(NULL); |
| 28 |
DROP TABLE t1_56228; |
| 29 |
RETURN 42; |
| 30 |
END // |
| 31 |
|
| 32 |
CREATE PROCEDURE bug56228() |
| 33 |
BEGIN |
| 34 |
INSERT INTO t1_56228 VALUES(NULL); |
| 35 |
INSERT INTO t2_56228 VALUES(NULL); |
| 36 |
INSERT INTO t1_56228 VALUES(NULL); |
| 37 |
INSERT INTO t2_56228 VALUES(NULL); |
| 38 |
DROP TABLE t1_56228; |
| 39 |
END // |
| 40 |
|
| 41 |
DELIMITER ;// |
| 42 |
|
| 43 |
CALL bug56228(); |
| 44 |
|
| 45 |
DROP PROCEDURE bug56228; |
| 46 |
DROP TABLE t2_56228; |