summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-10-26 09:54:37 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-10-26 09:54:37 +0300
commit58fe6b47d4e8580e370a094d8f5768d053aa52c1 (patch)
treee8a41c44327aa98ecb1fd62a3526c58025e73d35 /mysql-test
parent1193a793c40b806c6f1f007bbd87f4d9a73e686d (diff)
downloadmariadb-git-58fe6b47d4e8580e370a094d8f5768d053aa52c1.tar.gz
MDEV-26903: Assertion ctx->trx->state == TRX_STATE_ACTIVE on DROP INDEX
rollback_inplace_alter_table(): Tolerate a case where the transaction is not in an active state. If ha_innobase::commit_inplace_alter_table() failed with a deadlock, the transaction would already have been rolled back. This omission of error handling was introduced in commit 1bd681c8b3c5213ce1f7976940a7dc38b48a0d39 (MDEV-25506 part 3). After commit c3c53926c467c95386ae98d61ada87294bd61478 (MDEV-26554) it became easier to trigger DB_DEADLOCK during exclusive table lock acquisition in ha_innobase::commit_inplace_alter_table(). lock_table_low(): Add DBUG injection "innodb_table_deadlock".
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter-debug.result10
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-debug.test12
2 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/r/innodb-alter-debug.result b/mysql-test/suite/innodb/r/innodb-alter-debug.result
index 519283536d5..81fc67e55c7 100644
--- a/mysql-test/suite/innodb/r/innodb-alter-debug.result
+++ b/mysql-test/suite/innodb/r/innodb-alter-debug.result
@@ -132,4 +132,14 @@ ALTER TABLE t1 RENAME KEY idx TO idx1, ALGORITHM=COPY;
disconnect con1;
connection default;
DROP TABLE t1;
+#
+# MDEV-26903 Assertion ctx->trx->state == TRX_STATE_ACTIVE on DROP INDEX
+#
+CREATE TABLE t1(a INT PRIMARY KEY, b INT, INDEX(b)) ENGINE=InnoDB;
+SET @save_dbug=@@debug_dbug;
+SET debug_dbug='+d,innodb_table_deadlock';
+ALTER TABLE t1 DROP INDEX b, ALGORITHM=INPLACE;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SET debug_dbug=@save_dbug;
+DROP TABLE t1;
# End of 10.6 tests
diff --git a/mysql-test/suite/innodb/t/innodb-alter-debug.test b/mysql-test/suite/innodb/t/innodb-alter-debug.test
index 7af8e882724..1789ec294e4 100644
--- a/mysql-test/suite/innodb/t/innodb-alter-debug.test
+++ b/mysql-test/suite/innodb/t/innodb-alter-debug.test
@@ -177,6 +177,18 @@ disconnect con1;
connection default;
DROP TABLE t1;
+--echo #
+--echo # MDEV-26903 Assertion ctx->trx->state == TRX_STATE_ACTIVE on DROP INDEX
+--echo #
+
+CREATE TABLE t1(a INT PRIMARY KEY, b INT, INDEX(b)) ENGINE=InnoDB;
+SET @save_dbug=@@debug_dbug;
+SET debug_dbug='+d,innodb_table_deadlock';
+--error ER_LOCK_DEADLOCK
+ALTER TABLE t1 DROP INDEX b, ALGORITHM=INPLACE;
+SET debug_dbug=@save_dbug;
+DROP TABLE t1;
+
--echo # End of 10.6 tests
# Wait till all disconnects are completed