Bug #32140 wrong error code caught when an SF() call is interrupted with KILL query
Submitted: 6 Nov 2007 9:48 Modified: 6 Mar 2010 20:00
Reporter: Andrei Elkin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1 OS:Any
Assigned to: Davi Arnaut CPU Architecture:Any

[6 Nov 2007 9:48] Andrei Elkin
Description:
observing failures with binlog_killed test on mysql-5.1-new-rpl, one can find
that there are several similar patterns like 

binlog.binlog_killed           [ fail ]

Wmysqltest: At line 267: query 'reap' failed with wrong errno 1457: 'Failed to load routine test.bug27563. The table mysql.proc is missing, corrupt, or contains bad data (internal code -2)', instead of 0...

That happens for delete and update queries killing when the query calls 
a stored function.

Ref:
https://intranet.mysql.com/secure/pushbuild/getlog.pl?dir=mysql-5.1-new-rpl&entry=aelkin@k...

How to repeat:
Run the test on pb's env.
[8 Nov 2007 14:52] MySQL Verification Team
Thank you for the bug report.
[18 Apr 2008 13: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/45605

ChangeSet@1.2618, 2008-04-18 10:19:46-03:00, davi@mysql.com +1 -0
  Bug#32140: wrong error code caught when an SF() call is interruped with KILL query
  
  The problem is that killing a query which calls a stored function
  could return a wrong error (table corrupt) instead of the query
  interrupted error message.
  
  The solution is to not set the table corrupt error if the query
  is killed, the query interrupted error message will be set  later
  when the query is finished.
[20 Apr 2008 13:33] Davi Arnaut
Queued to 6.0-runtime
[22 May 2008 9:50] Bugs System
Pushed into 6.0.6-alpha
[10 Jul 2008 19:42] Paul DuBois
Noted in 6.0.6 changelog.

Killing a statement that invoked a stored function could return an
incorrect error message indicating table corruption rather than that
the statement had been interrupted.
[10 Nov 2009 18:15] 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/89991

2916 Davi Arnaut	2009-11-10
      Backport of Bug#32140 to mysql-next-mr
      ------------------------------------------------------------
      revno: 2618
      revision-id: sp1r-davi@mysql.com/endora.local-20080418131946-26951
      parent: sp1r-davi@mysql.com/endora.local-20080417190810-26185
      committer: davi@mysql.com/endora.local
      timestamp: Fri 2008-04-18 10:19:46 -0300
      message:
        Bug#32140: wrong error code caught when an SF() call is interruped with KILL query
      
        The problem is that killing a query which calls a stored function
        could return a wrong error (table corrupt) instead of the query
        interrupted error message.
      
        The solution is to not set the table corrupt error if the query
        is killed, the query interrupted error message will be set  later
        when the query is finished.
     @ sql/sp.cc
        Don't set a error if the thread was killed, the query
        interrupted error will be set later.
[10 Nov 2009 18:18] Davi Arnaut
Queued to mysql-next-mr-runtime
[20 Nov 2009 12:54] Bugs System
Pushed into 5.6.0-beta (revid:davi.arnaut@sun.com-20091119234808-xbjpkwaxjt5x5c0b) (version source revid:davi.arnaut@sun.com-20090522170916-fzc5ca3tjs9roy1t) (merge vers: 6.0.12-alpha) (pib:13)
[20 Nov 2009 12:58] Bugs System
Pushed into 6.0.14-alpha (revid:kostja@sun.com-20091120124947-yi6h2jbgw0kbciwm) (version source revid:davi.arnaut@sun.com-20090522170916-fzc5ca3tjs9roy1t) (merge vers: 6.0.12-alpha) (pib:13)
[22 Nov 2009 0:08] Paul DuBois
Noted in 5.6.0 changelog.

Already fixed in 6.0.x.
[6 Mar 2010 10:52] Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:davi.arnaut@sun.com-20090522170916-fzc5ca3tjs9roy1t) (merge vers: 6.0.12-alpha) (pib:16)
[6 Mar 2010 20:00] Paul DuBois
Moved 5.6.0 changelog entry to 5.5.3.