Skip to content
Permalink
Browse files

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.
  • Loading branch information...
montywi committed Jun 25, 2019
1 parent 41e02d1 commit 7a2958f456616991e649c8c2315cec7184e466ff
Showing with 31 additions and 5 deletions.
  1. +14 −0 mysql-test/suite/maria/alter.result
  2. +17 −4 mysql-test/suite/maria/alter.test
  3. +0 −1 storage/maria/ma_extra.c
@@ -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
#
@@ -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 #
@@ -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)

0 comments on commit 7a2958f

Please sign in to comment.
You can’t perform that action at this time.