Commit 38ecd541 authored by Monty's avatar Monty

MDEV-16986 Unitialized mutex, SIGSEGV and assorted assertion failures in Aria code

The problem was that when a mysql.proc table was
opened for reading it was added to the current Aria
transaction context but never properly deleted from
it. Normally this isn't a problem, except if the
mysql.proc table is closed before the transaction
ended, which happened in this test case.

Fixed by removing mysql.proc from the transaction
context before closing the table.
parent ee98e95e
CREATE TABLE t1 (i INT) ENGINE=Aria;
LOCK TABLE t1 WRITE;
connect con1,localhost,root,,test;
SET lock_wait_timeout= 2;
FLUSH TABLES;
connection default;
CALL non_existing_sp;
ERROR 42000: PROCEDURE test.non_existing_sp does not exist
connection con1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
disconnect con1;
connection default;
DROP TABLE t1;
#
# Test related to Aria system tables
#
#
# MDEV-16986 Unitialized mutex, SIGSEGV and assorted assertion failures in
# Aria code
#
CREATE TABLE t1 (i INT) ENGINE=Aria;
LOCK TABLE t1 WRITE;
--connect (con1,localhost,root,,test)
SET lock_wait_timeout= 2;
--send
FLUSH TABLES;
--connection default
--error ER_SP_DOES_NOT_EXIST
CALL non_existing_sp;
--connection con1
--error ER_LOCK_WAIT_TIMEOUT
--reap
# Cleanup
--disconnect con1
--connection default
DROP TABLE t1;
......@@ -8772,6 +8772,13 @@ open_system_tables_for_read(THD *thd, TABLE_LIST *table_list,
void
close_system_tables(THD *thd, Open_tables_backup *backup)
{
/*
Inform the transaction handler that we are closing the
system tables and we don't need the read view anymore.
*/
for (TABLE *table= thd->open_tables ; table ; table= table->next)
table->file->extra(HA_EXTRA_PREPARE_FOR_FORCED_CLOSE);
close_thread_tables(thd);
thd->restore_backup_open_tables_state(backup);
}
......
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