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.
modified:
sql/sql_base.cc
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:
mysql-test/r/lock_sync.result
mysql-test/t/lock_sync.test
sql/sql_base.cc
=== 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
end:
if (table == NULL)
{
- trans_rollback_stmt(thd);
+ if (!thd->in_sub_stmt)
+ trans_rollback_stmt(thd);
close_thread_tables(thd);
}
thd_proc_info(thd, 0);
Attachment: [text/bzr-bundle] bzr/jon.hauglid@oracle.com-20101014090237-l0z4at17gu3xs41t.bundle
| Thread |
|---|
| • bzr push into mysql-5.5-runtime branch (jon.hauglid:3164 to 3165) Bug#55930 | Jon Olav Hauglid | 14 Oct |