revision-id: b4c2ceb214c262c09094fd3d318c786368259760 parent(s): 1cb2e0333d3006f83370168c75d602edf2c3bfd1 committer: Sergei Petrunia branch nick: 10.2-r10 timestamp: 2018-04-07 15:03:15 +0300 message: MDEV-15769: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed Adjust the fix for MDEV-15472: In close_cached_tables(), locked_tables_list.reopen_tables(...) call might be made when a previous call to some function has already returned error. In this scenario, the function should return 0, even if reopen_tables(...) call has succeeded. --- mysql-test/r/lock.result | 16 ++++++++++++++++ mysql-test/t/lock.test | 21 +++++++++++++++++++++ sql/sql_base.cc | 3 ++- 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/lock.result b/mysql-test/r/lock.result index 00dbb16..e3fd16e 100644 --- a/mysql-test/r/lock.result +++ b/mysql-test/r/lock.result @@ -489,3 +489,19 @@ unlock tables; disconnect con1; connection default; drop table t1; +# +# MDEV-15769: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed in Diagnostics_area::set_ok_status +# +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); +LOCK TABLE t1 READ; +connect con1,localhost,root,,test; +LOCK TABLE t2 WRITE; +SET lock_wait_timeout= 1; +FLUSH TABLES; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +UNLOCK TABLES; +disconnect con1; +connection default; +UNLOCK TABLES; +DROP TABLE t1, t2; diff --git a/mysql-test/t/lock.test b/mysql-test/t/lock.test index 2e164de..2c2c5d4 100644 --- a/mysql-test/t/lock.test +++ b/mysql-test/t/lock.test @@ -598,3 +598,24 @@ unlock tables; disconnect con1; connection default; drop table t1; + +--echo # +--echo # MDEV-15769: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed in Diagnostics_area::set_ok_status +--echo # +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); +LOCK TABLE t1 READ; + +--connect (con1,localhost,root,,test) +LOCK TABLE t2 WRITE; +SET lock_wait_timeout= 1; +--error ER_LOCK_WAIT_TIMEOUT +FLUSH TABLES; + +# Cleanup +UNLOCK TABLES; +--disconnect con1 +--connection default +UNLOCK TABLES; +DROP TABLE t1, t2; + diff --git a/sql/sql_base.cc b/sql/sql_base.cc index ca3141b..aa4a775 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -481,7 +481,8 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, old locks. This should always succeed (unless some external process has removed the tables) */ - result= thd->locked_tables_list.reopen_tables(thd); + if (thd->locked_tables_list.reopen_tables(thd)) + result= true; /* Since downgrade_lock() won't do anything with shared metadata lock it is much simpler to go through all open tables rather