summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorAlexey Kopytov <Alexey.Kopytov@Sun.com>2009-06-23 10:15:27 +0400
committerAlexey Kopytov <Alexey.Kopytov@Sun.com>2009-06-23 10:15:27 +0400
commit73cbaa6d17b508e12af1d71b5d07f80f02acfeed (patch)
tree8edfea9c8acacee058ab048bed2f1f80866a4513 /sql/sql_parse.cc
parent5ce0b41fb247c004da35f3eaa49f38cb395d00dd (diff)
downloadmariadb-git-73cbaa6d17b508e12af1d71b5d07f80f02acfeed.tar.gz
Bug #45309: InnoDB does not rollback for delete and update
queries if query was killed Since we rely on thd->is_error() to decide whether we should COMMIT or ROLLBACK after a query execution, check the query 'killed' state and throw an error before calling ha_autocommit_or_rollback(), not after. The patch was tested manually. For reliable results, the test case would have to KILL QUERY while a DELETE/UPDATE query in another thread is still running. I don't see a way to achieve this kind of synchronization in our test suite (no debug_sync in 5.1). sql/sql_parse.cc: Since we rely on thd->is_error() to decide whether we should COMMIT or ROLLBACK after query execution, check the query 'killed' state and throw an error before calling ha_autocommit_or_rollback(), not after.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 9c621004cc3..c593f563052 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1560,14 +1560,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break;
}
- /* If commit fails, we should be able to reset the OK status. */
- thd->main_da.can_overwrite_status= TRUE;
- ha_autocommit_or_rollback(thd, thd->is_error());
- thd->main_da.can_overwrite_status= FALSE;
-
- thd->transaction.stmt.reset();
-
-
/* report error issued during command execution */
if (thd->killed_errno())
{
@@ -1580,6 +1572,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->mysys_var->abort= 0;
}
+ /* If commit fails, we should be able to reset the OK status. */
+ thd->main_da.can_overwrite_status= TRUE;
+ ha_autocommit_or_rollback(thd, thd->is_error());
+ thd->main_da.can_overwrite_status= FALSE;
+
+ thd->transaction.stmt.reset();
+
net_end_statement(thd);
query_cache_end_of_result(thd);