Bug #37145 Killing a statement doing DDL may log binlog event with error code 1053
Submitted: 2 Jun 2008 20:07 Modified: 8 Feb 2010 15:42
Reporter: Mark Callaghan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.0.54, 5.1.26 OS:Any
Assigned to: Zhenxing He CPU Architecture:Any
Tags: 1053, KILL, replication
Triage: Triaged: D2 (Serious)

[2 Jun 2008 20:07] Mark Callaghan
Description:
A similar problem (bugs 27571, 22725) was fixed in 5.0.40 and 5.0.54 for DML. The problem still exists for DDL. Most instances of this can be fixed for DDL as the code executing the DDL knows whether or not it completed the statement even when another thread sets THD::killed for that connection.

http://bugs.mysql.com/27571
http://bugs.mysql.com/22725

How to repeat:
Add sleep(10) to Query_log_event::Query_log_event before errror_code is assigned a value, run 'create table ...', kill that statement from another session, dump the binlog
[11 Jun 2008 18:53] Shane Bester
in session 1: create table t engine=innodb select sleep(100);
in session 2: show processlist;kill <id of session1>

on master, table is created.
on slave,  replication broke with: Error_code: 1053
[11 Jun 2008 19:01] Shane Bester
hm, in autocommit mode killing 'insert into t select sleep(100)' also stops the slave.
[12 Jun 2008 17:05] Mark Callaghan
Shane,
Does your testcase mean that one of the DML bugs should be reopened?
[12 Jan 2009 23:00] Justin Tolmer
This diff is a fix I implemented for this issue in our 5.0.67 branch.

Attachment: 37145.patch (application/octet-stream, text), 37.54 KiB.

[1 Mar 2009 10:03] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/67938

2731 He Zhenxing	2009-03-01
      BUG#37145 Killing a statement doing DDL may log binlog event with error code 1053
      
      When the thread executing a DDL was killed after finished its
      execution but before writing the binlog event, the error code in
      the binlog event could be set wrongly to ER_SERVER_SHUTDOWN or
      ER_QUERY_INTERRUPTED.
      
      This patch fixed the problem by ignoring the kill status when
      constructing the event for DDL statements.
      
      This patch also included the following changes in order to
      provide the test case.
      
       1) modified mysqltest to support variable for connection command
      
       2) modified mysql-test-run.pl, add new variable MYSQL_SLAVE to
          run mysql client against the slave mysqld.
[2 Mar 2009 1:25] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/67944

2731 He Zhenxing	2009-03-02
      BUG#37145 Killing a statement doing DDL may log binlog event with error code 1053
      
      When the thread executing a DDL was killed after finished its
      execution but before writing the binlog event, the error code in
      the binlog event could be set wrongly to ER_SERVER_SHUTDOWN or
      ER_QUERY_INTERRUPTED.
      
      This patch fixed the problem by ignoring the kill status when
      constructing the event for DDL statements.
      
      This patch also included the following changes in order to
      provide the test case.
      
       1) modified mysqltest to support variable for connection command
      
       2) modified mysql-test-run.pl, add new variable MYSQL_SLAVE to
          run mysql client against the slave mysqld.
[11 Mar 2009 7:16] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/68849

2714 He Zhenxing	2009-03-11
      BUG#37145 Killing a statement doing DDL may log binlog event with error code 1053
      
      When the thread executing a DDL was killed after finished its
      execution but before writing the binlog event, the error code in
      the binlog event could be set wrongly to ER_SERVER_SHUTDOWN or
      ER_QUERY_INTERRUPTED.
      
      This patch fixed the problem by ignoring the kill status when
      constructing the event for DDL statements.
      
      This patch also included the following changes in order to
      provide the test case.
      
       1) modified mysqltest to support variable for connection command
      
       2) modified mysql-test-run.pl, add new variable MYSQL_SLAVE to
          run mysql client against the slave mysqld.
[11 Mar 2009 7:22] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/68851

2714 He Zhenxing	2009-03-11
      BUG#37145 Killing a statement doing DDL may log binlog event with error code 1053
      
      When the thread executing a DDL was killed after finished its
      execution but before writing the binlog event, the error code in
      the binlog event could be set wrongly to ER_SERVER_SHUTDOWN or
      ER_QUERY_INTERRUPTED.
      
      This patch fixed the problem by ignoring the kill status when
      constructing the event for DDL statements.
      
      This patch also included the following changes in order to
      provide the test case.
      
       1) modified mysqltest to support variable for connection command
      
       2) modified mysql-test-run.pl, add new variable MYSQL_SLAVE to
          run mysql client against the slave mysqld.
[23 Mar 2009 10:46] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/70033

2714 He Zhenxing	2009-03-23
      BUG#37145 Killing a statement doing DDL may log binlog event with error code 1053
      
      When the thread executing a DDL was killed after finished its
      execution but before writing the binlog event, the error code in
      the binlog event could be set wrongly to ER_SERVER_SHUTDOWN or
      ER_QUERY_INTERRUPTED.
      
      This patch fixed the problem by ignoring the kill status when
      constructing the event for DDL statements.
      
      This patch also included the following changes in order to
      provide the test case.
      
       1) modified mysqltest to support variable for connection command
      
       2) modified mysql-test-run.pl, add new variable MYSQL_SLAVE to
          run mysql client against the slave mysqld.
[27 Mar 2009 2:38] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/70610

2779 He Zhenxing	2009-03-27
      BUG#37145 Killing a statement doing DDL may log binlog event with error code 1053
      
      When the thread executing a DDL was killed after finished its
      execution but before writing the binlog event, the error code in
      the binlog event could be set wrongly to ER_SERVER_SHUTDOWN or
      ER_QUERY_INTERRUPTED.
      
      This patch fixed the problem by ignoring the kill status when
      constructing the event for DDL statements.
      
      This patch also included the following changes in order to
      provide the test case.
      
       1) modified mysqltest to support variable for connection command
      
       2) modified mysql-test-run.pl, add new variable MYSQL_SLAVE to
          run mysql client against the slave mysqld.
[27 Mar 2009 5:17] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/70621

2716 He Zhenxing	2009-03-27
      BUG#37145 Killing a statement doing DDL may log binlog event with error code 1053
      
      When the thread executing a DDL was killed after finished its
      execution but before writing the binlog event, the error code in
      the binlog event could be set wrongly to ER_SERVER_SHUTDOWN or
      ER_QUERY_INTERRUPTED.
      
      This patch fixed the problem by ignoring the kill status when
      constructing the event for DDL statements.
      
      This patch also included the following changes in order to
      provide the test case.
      
       1) modified mysqltest to support variable for connection command
      
       2) modified mysql-test-run.pl, add new variable MYSQL_SLAVE to
          run mysql client against the slave mysqld.
      
      ******
      BUG#37145 Killing a statement doing DDL may log binlog event with error code 1053
      
      When the thread executing a DDL was killed after finished its
      execution but before writing the binlog event, the error code in
      the binlog event could be set wrongly to ER_SERVER_SHUTDOWN or
      ER_QUERY_INTERRUPTED.
      
      This patch fixed the problem by ignoring the kill status when
      constructing the event for DDL statements.
      
      This patch also included the following changes in order to
      provide the test case.
      
       1) modified mysqltest to support variable for connection command
      
       2) modified mysql-test-run.pl, add new variable MYSQL_SLAVE to
          run mysql client against the slave mysqld.
[27 Mar 2009 5:20] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/70622

2716 He Zhenxing	2009-03-27
      BUG#37145 Killing a statement doing DDL may log binlog event with error code 1053
      
      When the thread executing a DDL was killed after finished its
      execution but before writing the binlog event, the error code in
      the binlog event could be set wrongly to ER_SERVER_SHUTDOWN or
      ER_QUERY_INTERRUPTED.
      
      This patch fixed the problem by ignoring the kill status when
      constructing the event for DDL statements.
      
      This patch also included the following changes in order to
      provide the test case.
      
       1) modified mysqltest to support variable for connection command
      
       2) modified mysql-test-run.pl, add new variable MYSQL_SLAVE to
          run mysql client against the slave mysqld.
[8 Apr 2009 7:25] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/71610

2860 He Zhenxing	2009-04-08 [merge]
      Manually merge BUG#37145 to 5.1-bugteam
[8 Apr 2009 23:44] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/71702

2855 He Zhenxing	2009-04-09 [merge]
      Manually merge BUG#37145 to 5.1-bugteam
[9 Apr 2009 6:22] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/71714

2857 He Zhenxing	2009-04-09
      Post fix of BUG#37145
      
      Binlog the CREATE EVENT unless the created event been successfully dropped
      
      Modified Query_log_event constructor to make sure that error_code
      is not set to ER_SERVER_SHUTDOWN or ER_QUERY_INTERRUPTED errors
      when NOT_KILLED
     @ sql/events.cc
        binlog the create event unless it's been successfully dropped
     @ sql/log_event.cc
        Modified Query_log_event constructor to make sure that error_code
        is not set to ER_SERVER_SHUTDOWN or ER_QUERY_INTERRUPTED errors
        when NOT_KILLED
[9 Apr 2009 6:25] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/71715

3193 He Zhenxing	2009-04-09 [merge]
      Merge postfix of BUG#37145 from 5.1-bugteam
[9 Apr 2009 6:37] Zhenxing He
pushed to 5.0-bugteam, 5.1-bugteam, 6.0-bugteam
[9 Apr 2009 7:10] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/71723

2719 He Zhenxing	2009-04-09
      post fix a warning after push BUG#37145 to 5.0-bugteam
[9 Apr 2009 7:43] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/71726

2719 He Zhenxing	2009-04-09
      post fix compiling problem after push BUG#37145 to 5.0-bugteam
[9 Apr 2009 8:59] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/71741

2721 He Zhenxing	2009-04-09
      Fix compile error on windows for BUG#37145 on 5.0-bugteam
[5 May 2009 18:54] Bugs System
Pushed into 5.0.82 (revid:davi.arnaut@sun.com-20090505184158-dvmedh8n472y8np5) (version source revid:davi.arnaut@sun.com-20090505184158-dvmedh8n472y8np5) (merge vers: 5.0.82) (pib:6)
[5 May 2009 19:43] Bugs System
Pushed into 5.1.35 (revid:davi.arnaut@sun.com-20090505190206-9xmh7dlc6kom8exp) (version source revid:davi.arnaut@sun.com-20090505190206-9xmh7dlc6kom8exp) (merge vers: 5.1.35) (pib:6)
[6 May 2009 12:12] Jon Stephens
Documented bugfix in the 5.0.82 and 5.1.35 changelogs, as follows:

        Killing the thread executing a DDL, after it had finished its
        execution but before it had written the binlog event, caused the
        error code in the binlog event to be set (incorrectly) to
        ER_SERVER_SHUTDOWN or ER_QUERY_INTERRUPTED, which caused
        replication to fail.

Set status NDI: waiting for 6.0 merge/version info.
[6 May 2009 14:11] Bugs System
Pushed into 6.0.12-alpha (revid:svoj@sun.com-20090506125450-yokcmvqf2g7jhujq) (version source revid:sergey.glukhov@sun.com-20090409100053-gojyfc2uv3l9d5wl) (merge vers: 6.0.11-alpha) (pib:6)
[6 May 2009 14:25] Jon Stephens
Bugfix also noted in the 6.0.12 changelog; closed.
[15 Jun 2009 8:29] Bugs System
Pushed into 5.1.35-ndb-6.3.26 (revid:jonas@mysql.com-20090615074202-0r5r2jmi83tww6sf) (version source revid:jonas@mysql.com-20090615070837-9pccutgc7repvb4d) (merge vers: 5.1.35-ndb-6.3.26) (pib:6)
[15 Jun 2009 9:08] Bugs System
Pushed into 5.1.35-ndb-7.0.7 (revid:jonas@mysql.com-20090615074335-9hcltksp5cu5fucn) (version source revid:jonas@mysql.com-20090615072714-rmfkvrbbipd9r32c) (merge vers: 5.1.35-ndb-7.0.7) (pib:6)
[15 Jun 2009 9:50] Bugs System
Pushed into 5.1.35-ndb-6.2.19 (revid:jonas@mysql.com-20090615061520-sq7ds4yw299ggugm) (version source revid:jonas@mysql.com-20090615054654-ebgpz7elwu1xj36j) (merge vers: 5.1.35-ndb-6.2.19) (pib:6)
[24 Jan 2010 8:00] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/97984

3846 He Zhenxing	2010-01-24 [merge]
      Null merge backporing of Bug#37145
[5 Feb 2010 11:57] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100205113942-oqovjy0eoqbarn7i) (version source revid:alik@sun.com-20100204064210-ljwanqvrjs83s1gq) (merge vers: 6.0.14-alpha) (pib:16)
[8 Feb 2010 15:42] Jon Stephens
Already documented in the 6.0.12 changelog -- re-closing.