Commit e26c822a authored by Monty's avatar Monty

MDEV-16929 Assertion ... in close_thread_tables upon killing connection

Problem was that the code didn't handle a transaction created in innodb
as part of a failed mysql_lock_tables()
parent af83ed9f
#
# MDEV-16929 Assertion ... in close_thread_tables upon killing connection
# running SHOW on sequence
#
CREATE SEQUENCE s ENGINE=InnoDB;
RENAME TABLE s TO s1;
connect con1,localhost,root,,test;
SHOW CREATE SEQUENCE s1;
connection default;
KILL thread_id;
connection default;
drop sequence s1;
--source include/have_innodb.inc
--echo #
--echo # MDEV-16929 Assertion ... in close_thread_tables upon killing connection
--echo # running SHOW on sequence
--echo #
CREATE SEQUENCE s ENGINE=InnoDB;
RENAME TABLE s TO s1;
--connect (con1,localhost,root,,test)
--let $conid= `SELECT CONNECTION_ID()`
--send
SHOW CREATE SEQUENCE s1;
--connection default
--replace_result $conid thread_id
--eval KILL $conid
# Cleanup
--connection default
drop sequence s1;
...@@ -485,6 +485,10 @@ int SEQUENCE::read_initial_values(TABLE *table) ...@@ -485,6 +485,10 @@ int SEQUENCE::read_initial_values(TABLE *table)
if (mdl_lock_used) if (mdl_lock_used)
thd->mdl_context.release_lock(mdl_request.ticket); thd->mdl_context.release_lock(mdl_request.ticket);
write_unlock(table); write_unlock(table);
if (!has_active_transaction && !thd->transaction.stmt.is_empty() &&
!thd->in_sub_stmt)
trans_commit_stmt(thd);
DBUG_RETURN(HA_ERR_LOCK_WAIT_TIMEOUT); DBUG_RETURN(HA_ERR_LOCK_WAIT_TIMEOUT);
} }
DBUG_ASSERT(table->reginfo.lock_type == TL_READ); DBUG_ASSERT(table->reginfo.lock_type == TL_READ);
......
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