Commit 56045ef9 authored by Monty's avatar Monty

Fix for crash in Aria LOCK TABLES + CREATE TRIGGER

MDEV-22829 SIGSEGV in _ma_reset_history on LOCK
parent ab7eedc1
......@@ -166,3 +166,14 @@ test.t1 optimize status Table is already up to date
disconnect con1;
connection default;
DROP TABLE t1, t2;
#
# MDEV-22829 SIGSEGV in _ma_reset_history on LOCK
#
CREATE TABLE t1 (f1 INT) ENGINE=Aria;
CREATE TABLE t2 (f2 INT) ENGINE=Aria;
LOCK TABLES t2 WRITE, t1 WRITE;
INSERT INTO t1 VALUES (1);
CREATE TRIGGER ai AFTER INSERT ON t1 FOR EACH ROW UPDATE t1 SET v=1 WHERE b=new.a;
ERROR 42S22: Unknown column 'a' in 'NEW'
UNLOCK TABLES;
DROP TABLE t1, t2;
......@@ -185,3 +185,16 @@ OPTIMIZE TABLE t1;
--disconnect con1
--connection default
DROP TABLE t1, t2;
--echo #
--echo # MDEV-22829 SIGSEGV in _ma_reset_history on LOCK
--echo #
CREATE TABLE t1 (f1 INT) ENGINE=Aria;
CREATE TABLE t2 (f2 INT) ENGINE=Aria;
LOCK TABLES t2 WRITE, t1 WRITE;
INSERT INTO t1 VALUES (1);
--error ER_BAD_FIELD_ERROR
CREATE TRIGGER ai AFTER INSERT ON t1 FOR EACH ROW UPDATE t1 SET v=1 WHERE b=new.a;
UNLOCK TABLES;
DROP TABLE t1, t2;
......@@ -558,7 +558,11 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
/* Later on we will need it to downgrade the lock */
mdl_ticket= table->mdl_ticket;
if (wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN))
/*
RENAME ensures that table is flushed properly and locked tables will
be removed from the active transaction
*/
if (wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_RENAME))
goto end;
lock_upgrade_done= TRUE;
......
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