summaryrefslogtreecommitdiff
path: root/sql/sql_admin.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_admin.cc')
-rw-r--r--sql/sql_admin.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index 16fcf120128..f07a8089853 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -859,8 +859,20 @@ send_result_message:
}
}
/* Error path, a admin command failed. */
- trans_commit_stmt(thd);
- trans_commit_implicit(thd);
+ if (thd->transaction_rollback_request)
+ {
+ /*
+ Unlikely, but transaction rollback was requested by one of storage
+ engines (e.g. due to deadlock). Perform it.
+ */
+ if (trans_rollback_stmt(thd) || trans_rollback_implicit(thd))
+ goto err;
+ }
+ else
+ {
+ if (trans_commit_stmt(thd) || trans_commit_implicit(thd))
+ goto err;
+ }
close_thread_tables(thd);
thd->mdl_context.release_transactional_locks();