Commit fb5d9a82 authored by Dmitry Lenev's avatar Dmitry Lenev

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.
parent 72ff5686
......@@ -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. */
......
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