ha_innodb.cc, handler.cc:

  Fix the BDB crash in the previous push; to save CPU remove duplicate calls of commit in InnoDB
parent 4851b571
This diff is collapsed.
...@@ -209,44 +209,26 @@ void ha_close_connection(THD* thd) ...@@ -209,44 +209,26 @@ void ha_close_connection(THD* thd)
/* /*
This is used to commit or rollback a single statement depending on the value This is used to commit or rollback a single statement depending on the value
of error. If the autocommit is on, then we will commit or rollback the whole of error. Note that if the autocommit is on, then the following call inside
transaction (= the statement). The autocommit mechanism built into handlers InnoDB will commit or rollback the whole transaction (= the statement). The
is based on counting locks, but if the user has used LOCK TABLES then that autocommit mechanism built into InnoDB is based on counting locks, but if
mechanism does not know to do the commit. the user has used LOCK TABLES then that mechanism does not know to do the
commit.
*/ */
int ha_autocommit_or_rollback(THD *thd, int error) int ha_autocommit_or_rollback(THD *thd, int error)
{ {
bool do_autocommit=FALSE;
DBUG_ENTER("ha_autocommit_or_rollback"); DBUG_ENTER("ha_autocommit_or_rollback");
#ifdef USING_TRANSACTIONS #ifdef USING_TRANSACTIONS
if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
do_autocommit=TRUE; /* We can commit or rollback the whole transaction */
if (opt_using_transactions) if (opt_using_transactions)
{ {
if (!error) if (!error)
{
if (do_autocommit)
{
if (ha_commit(thd))
error=1;
}
else
{ {
if (ha_commit_stmt(thd)) if (ha_commit_stmt(thd))
error=1; error=1;
} }
}
else
{
if (do_autocommit)
(void) ha_rollback(thd);
else else
(void) ha_rollback_stmt(thd); (void) ha_rollback_stmt(thd);
}
thd->variables.tx_isolation=thd->session_tx_isolation; thd->variables.tx_isolation=thd->session_tx_isolation;
} }
......
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