Commit 4c1333e6 authored by Davi Arnaut's avatar Davi Arnaut

Bug#45548: XA transaction without access to InnoDB tables crashes the server

The problem is that the one phase commit function failed to
properly end a empty transaction. The solution is to ensure
that the transaction cleanup procedure is invoked even for
empty transactions.
parent cbfcafd4
...@@ -81,3 +81,11 @@ xa rollback 'a'; ...@@ -81,3 +81,11 @@ xa rollback 'a';
xa start 'a'; xa start 'a';
xa end 'a'; xa end 'a';
xa rollback 'a'; xa rollback 'a';
xa start 'a';
xa end 'a';
xa prepare 'a';
xa commit 'a';
xa start 'a';
xa end 'a';
xa prepare 'a';
xa commit 'a';
...@@ -135,6 +135,20 @@ xa start 'a'; ...@@ -135,6 +135,20 @@ xa start 'a';
xa end 'a'; xa end 'a';
xa rollback 'a'; xa rollback 'a';
#
# Bug#45548: XA transaction without access to InnoDB tables crashes the server
#
xa start 'a';
xa end 'a';
xa prepare 'a';
xa commit 'a';
xa start 'a';
xa end 'a';
xa prepare 'a';
xa commit 'a';
# Wait till all disconnects are completed # Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc
...@@ -1242,9 +1242,10 @@ int ha_commit_one_phase(THD *thd, bool all) ...@@ -1242,9 +1242,10 @@ int ha_commit_one_phase(THD *thd, bool all)
#endif #endif
thd->variables.tx_isolation=thd->session_tx_isolation; thd->variables.tx_isolation=thd->session_tx_isolation;
} }
if (is_real_trans)
thd->transaction.cleanup();
} }
/* Free resources and perform other cleanup even for 'empty' transactions. */
if (is_real_trans)
thd->transaction.cleanup();
#endif /* USING_TRANSACTIONS */ #endif /* USING_TRANSACTIONS */
DBUG_RETURN(error); DBUG_RETURN(error);
} }
......
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