diff options
author | Dmitry Lenev <Dmitry.Lenev@oracle.com> | 2013-08-26 14:43:12 +0400 |
---|---|---|
committer | Dmitry Lenev <Dmitry.Lenev@oracle.com> | 2013-08-26 14:43:12 +0400 |
commit | fb5d9a82a783f8a5046daeb1b90884d133b803a5 (patch) | |
tree | 10178054c07e2065d920b42ed3a51f5b4e0f1b8d /sql/transaction.cc | |
parent | 72ff5686a06077106e2c11d47eb18b9228ba9faf (diff) | |
download | mariadb-git-fb5d9a82a783f8a5046daeb1b90884d133b803a5.tar.gz |
Fix for bug #17356954 "CANNOT USE SAVEPOINTS AFTER ER_LOCK_DEADLOCK OR
ER_LOCK_WAIT_TIMEOUT".
The problem was that after changes caused by fix bug 14188793 "DEADLOCK
CAUSED BY ALTER TABLE DOEN'T CLEAR STATUS OF ROLLBACKED TRANSACTION"/
bug 17054007 "TRANSACTION IS NOT FULLY ROLLED BACK IN CASE OF INNODB
DEADLOCK implicit rollback of transaction which occurred on ER_LOCK_DEADLOCK
(and ER_LOCK_WAIT_TIMEOUT if innodb_rollback_on_timeout option was set)
didn't start new transaction in @@autocommit=1 mode.
Such behavior although consistent with behavior of explicit ROLLBACK has
broken expectations of users and backward compatibility assumptions.
This patch fixes problem by reverting to starting new transaction
in 5.5/5.6.
The plan is to keep new behavior in trunk so the code change from this
patch is to be null-merged there.
Diffstat (limited to 'sql/transaction.cc')
-rw-r--r-- | sql/transaction.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/transaction.cc b/sql/transaction.cc index 4fd6af39135..ae38e920a1d 100644 --- a/sql/transaction.cc +++ b/sql/transaction.cc @@ -298,7 +298,12 @@ bool trans_rollback_implicit(THD *thd) thd->server_status&= ~SERVER_STATUS_IN_TRANS; DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS")); res= ha_rollback_trans(thd, true); - thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG); + /* + We don't reset OPTION_BEGIN flag below to simulate implicit start + of new transacton in @@autocommit=1 mode. This is necessary to + preserve backward compatibility. + */ + thd->variables.option_bits&= ~(OPTION_KEEP_LOG); thd->transaction.all.modified_non_trans_table= false; /* Rollback should clear transaction_rollback_request flag. */ |