Commit ff9150f3 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-25942: Assertion failure in trx_t::drop_table()

trx_t::drop_table(): Relax also another assertion that would fail
due to an AUTO_INCREMENT lock that is being held by the current
test case. This should have been part of
commit 63e9a054.
parent c2ebe814
......@@ -37,3 +37,18 @@ REPLACE INTO t1 VALUES (1,12);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`f`) REFERENCES `nonexistent` (`x`))
COMMIT;
DROP TABLE t1;
#
# MDEV-25942 Assertion failed in trx_t::drop_table()
#
CREATE TABLE t1 (k INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 SET k=1;
START TRANSACTION;
INSERT INTO t1 SET k=2;
connect con1,localhost,root,,test;
SET innodb_lock_wait_timeout= 1;
CREATE TABLE t2 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB
AS SELECT k FROM t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
disconnect con1;
connection default;
DROP TABLE t1;
......@@ -39,3 +39,22 @@ REPLACE INTO t1 VALUES (1,12);
COMMIT;
DROP TABLE t1;
--echo #
--echo # MDEV-25942 Assertion failed in trx_t::drop_table()
--echo #
CREATE TABLE t1 (k INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 SET k=1;
START TRANSACTION;
INSERT INTO t1 SET k=2;
--connect (con1,localhost,root,,test)
SET innodb_lock_wait_timeout= 1;
--error ER_LOCK_WAIT_TIMEOUT
CREATE TABLE t2 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB
AS SELECT k FROM t1;
--disconnect con1
--connection default
DROP TABLE t1;
......@@ -159,10 +159,16 @@ dberr_t trx_t::drop_table(const dict_table_t &table)
lock= UT_LIST_GET_NEXT(un_member.tab_lock.locks, lock))
{
ut_ad(lock->trx == this);
if (lock->type_mode == (LOCK_X | LOCK_TABLE))
switch (lock->type_mode) {
case LOCK_TABLE | LOCK_X:
found_x= true;
else
ut_ad(lock->type_mode == (LOCK_IX | LOCK_TABLE));
break;
case LOCK_TABLE | LOCK_IX:
case LOCK_TABLE | LOCK_AUTO_INC:
break;
default:
ut_ad("unexpected lock type" == 0);
}
}
ut_ad(found_x);
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment