Commit 55b83d71 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.

mysql-test/r/xa.result:
  Add test case result for Bug#45548
mysql-test/t/xa.test:
  Add test case for Bug#45548
sql/handler.cc:
  Invoke transaction cleanup function whenever a transaction is ended.
parent a921a99a
......@@ -81,3 +81,11 @@ xa rollback 'a';
xa start 'a';
xa end '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';
xa end '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
--source include/wait_until_count_sessions.inc
......@@ -1242,9 +1242,10 @@ int ha_commit_one_phase(THD *thd, bool all)
#endif
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 */
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