3165 Jon Olav Hauglid 2010-10-14
Follow-up for Bug #55930 Assertion `thd->transaction.stmt.is_empty()
|| thd->in_sub_stmt || (thd->state..
Don't rollback statement transactions if we are in a sub-statement.
This could for example happen for open_ltable() when opening the
general log during execution of a stored procedure.
3164 Jon Olav Hauglid 2010-10-13
Bug #55930 Assertion `thd->transaction.stmt.is_empty() ||
thd->in_sub_stmt || (thd->state..
OPTIMIZE TABLE is not directly supported by InnoDB. Instead,
recreate and analyze of the table is done. After recreate,
the table is closed and locks are released before the table
is reopened and locks re-acquired for the analyze phase.
This assertion was triggered if OPTIMIZE TABLE failed to
acquire thr_lock locks before starting the analyze phase.
The assertion tests (among other things) that there no
active statement transaction. However, as part of acquiring
the thr_lock lock, external_lock() is called for InnoDB
tables and this causes a statement transaction to be started.
If thr_multi_lock() later fails (e.g. due to timeout),
the failure handling code causes this assert to be triggered.
This patch fixes the problem by doing rollback of the
current statement transaction in case open_ltable (used by
OPTIMIZE TABLE) fails to acquire thr_lock locks.
Test case added to lock_sync.test.
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2010-10-13 14:15:28 +0000
+++ b/sql/sql_base.cc 2010-10-14 09:02:37 +0000
@@ -5320,7 +5320,8 @@ TABLE *open_ltable(THD *thd, TABLE_LIST
if (table == NULL)
+ if (!thd->in_sub_stmt)
Attachment: [text/bzr-bundle] firstname.lastname@example.org
|• bzr push into mysql-5.5-runtime branch (jon.hauglid:3164 to 3165) Bug#55930||Jon Olav Hauglid||14 Oct|