Commit 7a2958f4 authored by Monty's avatar Monty

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.
parent 41e02d14
......@@ -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)
......
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