diff options
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 4666d4c8ad2..028b4488573 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1527,10 +1527,16 @@ int ha_rollback_trans(THD *thd, bool all) } trans->ha_list= 0; trans->no_2pc=0; - if (is_real_trans && thd->transaction_rollback_request && - thd->transaction.xid_state.xa_state != XA_NOTR) - thd->transaction.xid_state.rm_error= thd->stmt_da->sql_errno(); } + + /* + Thanks to possibility of MDL deadlock rollback request can come even if + transaction hasn't been started in any transactional storage engine. + */ + if (is_real_trans && thd->transaction_rollback_request && + thd->transaction.xid_state.xa_state != XA_NOTR) + thd->transaction.xid_state.rm_error= thd->stmt_da->sql_errno(); + /* Always cleanup. Even if nht==0. There may be savepoints. */ if (is_real_trans) thd->transaction.cleanup(); |