summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorRamil Kalimullin <ramil@mysql.com>2009-03-27 10:24:32 +0400
committerRamil Kalimullin <ramil@mysql.com>2009-03-27 10:24:32 +0400
commitb05109479ab81c97a9b6a7bc1e308d9866ec8725 (patch)
tree724935190d8b69f11e5a0110b89287881ee73cb9 /sql/handler.cc
parent7a9d23226ce33a0908b087b9d9d68ded907d9711 (diff)
downloadmariadb-git-b05109479ab81c97a9b6a7bc1e308d9866ec8725.tar.gz
Fix for bug #26288: savepoint not deleted, comit on empty transaction
Problem: commit doesn't delete savepoints if there are no changes in the transaction. Fix: delete them in such cases. mysql-test/r/innodb_mysql.result: Fix for bug #26288: savepoint not deleted, comit on empty transaction - test result. mysql-test/t/innodb_mysql.test: Fix for bug #26288: savepoint not deleted, comit on empty transaction - test case. sql/handler.cc: Fix for bug #26288: savepoint not deleted, comit on empty transaction - call transaction.cleanup() even if nht is 0 to delete possible savepoints.
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index d069d56caae..63f652fc2b4 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -730,6 +730,16 @@ end:
if (is_real_trans)
start_waiting_global_read_lock(thd);
}
+ else if (all)
+ {
+ /*
+ A COMMIT of an empty transaction. There may be savepoints.
+ Destroy them. If the transaction is not empty
+ savepoints are cleared in ha_commit_one_phase()
+ or ha_rollback_trans().
+ */
+ thd->transaction.cleanup();
+ }
#endif /* USING_TRANSACTIONS */
DBUG_RETURN(error);
}
@@ -825,11 +835,11 @@ int ha_rollback_trans(THD *thd, bool all)
thd->transaction.xid_state.xid.null();
}
if (all)
- {
thd->variables.tx_isolation=thd->session_tx_isolation;
- thd->transaction.cleanup();
- }
}
+ /* Always cleanup. Even if there nht==0. There may be savepoints. */
+ if (all)
+ thd->transaction.cleanup();
#endif /* USING_TRANSACTIONS */
if (all)
thd->transaction_rollback_request= FALSE;