List:Commits« Previous MessageNext Message »
From:Alexey Kopytov Date:June 23 2009 6:15am
Subject:bzr commit into mysql-5.1-bugteam branch (Alexey.Kopytov:2968)
Bug#45309
View as plain text  
#At file:///data/src/bzr/bugteam/bug45309/my51-bug45309/ based on revid:matthias.leich@stripped

 2968 Alexey Kopytov	2009-06-23
      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.

    modified:
      sql/sql_parse.cc
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2009-06-17 14:56:44 +0000
+++ b/sql/sql_parse.cc	2009-06-23 06:15:27 +0000
@@ -1560,14 +1560,6 @@ bool dispatch_command(enum enum_server_c
     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_c
     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);
 


Attachment: [text/bzr-bundle] bzr/alexey.kopytov@sun.com-20090623061527-lungz4natx8n4v5t.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (Alexey.Kopytov:2968)Bug#45309Alexey Kopytov23 Jun
  • Re: bzr commit into mysql-5.1-bugteam branch (Alexey.Kopytov:2968)Bug#45309Konstantin Osipov27 Jun