summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2019-06-25 15:59:57 +0300
committerMonty <monty@mariadb.org>2019-06-25 16:17:29 +0300
commit7a2958f456616991e649c8c2315cec7184e466ff (patch)
tree28a09b67c7e56b0335266ec3c8edda2177065f50
parent41e02d149e6f4fc31a05e3f17c73321f69515919 (diff)
downloadmariadb-git-7a2958f456616991e649c8c2315cec7184e466ff.tar.gz
MDEV-17576 Assertion in maria_extra upon ALTER on table with triggers and locks
The problem was that the code in maria_extra assumed that there could be only one table open when doing maria_extra(MA_FORCE_REOPEN) However in the case of triggers, there can be multiple copies of the table open. Fixed by removing assert.
-rw-r--r--mysql-test/suite/maria/alter.result14
-rw-r--r--mysql-test/suite/maria/alter.test21
-rw-r--r--storage/maria/ma_extra.c1
3 files changed, 31 insertions, 5 deletions
diff --git a/mysql-test/suite/maria/alter.result b/mysql-test/suite/maria/alter.result
index ea72328a38f..849aa6803f1 100644
--- a/mysql-test/suite/maria/alter.result
+++ b/mysql-test/suite/maria/alter.result
@@ -90,3 +90,17 @@ check table t2;
Table Op Msg_type Msg_text
test.t2 check status OK
DROP TABLE t1,t2;
+#
+# MDEV-17576
+# Assertion `share->reopen == 1' failed in maria_extra upon ALTER on
+# Aria table with triggers and locks
+#
+CREATE TABLE t1 (a INT) ENGINE=Aria;
+CREATE TRIGGER tr BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t1 SELECT * FROM t1;
+LOCK TABLE t1 WRITE;
+ALTER TABLE t1 FORCE, LOCK=EXCLUSIVE;
+DROP TRIGGER tr;
+DROP TABLE t1;
+#
+# End of 10.2 test
+#
diff --git a/mysql-test/suite/maria/alter.test b/mysql-test/suite/maria/alter.test
index ef21ab2e5d2..31eeac1df87 100644
--- a/mysql-test/suite/maria/alter.test
+++ b/mysql-test/suite/maria/alter.test
@@ -11,7 +11,7 @@ drop table if exists t1;
CREATE TABLE t1 (pk INT, d DATETIME, PRIMARY KEY(pk), KEY(d)) ENGINE=Aria;
ALTER TABLE t1 DISABLE KEYS;
INSERT INTO t1 VALUES (1,'2000-01-01 22:22:22'),(2,'2012-12-21 12:12:12');
-INSERT INTO t1 VALUES (3, '2008-07-24');
+INSERT INTO t1 VALUES (3, '2008-07-24');
ALTER TABLE t1 ENABLE KEYS;
SELECT t1a.pk FROM t1 AS t1a LEFT JOIN t1 AS t1b ON t1a.pk = t1b.pk;
@@ -74,6 +74,19 @@ check table t1;
check table t2;
DROP TABLE t1,t2;
-#
-# End of 10.2 tests
-#
+--echo #
+--echo # MDEV-17576
+--echo # Assertion `share->reopen == 1' failed in maria_extra upon ALTER on
+--echo # Aria table with triggers and locks
+--echo #
+
+CREATE TABLE t1 (a INT) ENGINE=Aria;
+CREATE TRIGGER tr BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t1 SELECT * FROM t1;
+LOCK TABLE t1 WRITE;
+ALTER TABLE t1 FORCE, LOCK=EXCLUSIVE;
+DROP TRIGGER tr;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.2 test
+--echo #
diff --git a/storage/maria/ma_extra.c b/storage/maria/ma_extra.c
index 7d8f8b8d27c..2697c72f2b8 100644
--- a/storage/maria/ma_extra.c
+++ b/storage/maria/ma_extra.c
@@ -286,7 +286,6 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function,
We however do a flush here for additional safety.
*/
/** @todo consider porting these flush-es to MyISAM */
- DBUG_ASSERT(share->reopen == 1);
error= _ma_flush_table_files(info, MARIA_FLUSH_DATA | MARIA_FLUSH_INDEX,
FLUSH_FORCE_WRITE, FLUSH_FORCE_WRITE);
if (!error && share->changed)