Bug #64556 Interrupting a query inside InnoDB causes an unrelated warning to be raised
Submitted: 5 Mar 2012 21:44 Modified: 20 Dec 2013 11:14
Reporter: Davi Arnaut (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.5 OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution
Triage: Needs Triage: D3 (Medium)

[5 Mar 2012 21:44] Davi Arnaut
Description:
Interrupting a statement (with kILL QUERY) while executing inside InnoDB leads to an unrelated warning being raised in the connection that is executing the statement that is being interrupted.

How to repeat:
Kill a query waiting for a row lock inside InnoDB and do a SHOW WARNINGS afterwards:

Warning	152	InnoDB: Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 255. Please drop extra constraints and try again

Suggested fix:
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -950,7 +950,7 @@ convert_error_code_to_mysql(
 
        case DB_INTERRUPTED:
                my_error(ER_QUERY_INTERRUPTED, MYF(0));
-               /* fall through */
+               return(-1);
 
        case DB_FOREIGN_EXCEED_MAX_CASCADE:
                push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
[6 Mar 2012 5:04] Valeriy Kravchuk
Thank you for the bug report. Verified with 5.5.20 on Mac:

mysql> delete from tinno1 where c1 = 2;
ERROR 1317 (70100): Query execution was interrupted
mysql> show warnings\G
*************************** 1. row ***************************
  Level: Error
   Code: 1317
Message: Query execution was interrupted
*************************** 2. row ***************************
  Level: Warning
   Code: 152
Message: InnoDB: Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 255. Please drop extra constraints and try again
*************************** 3. row ***************************
  Level: Error
   Code: 1317
Message: Query execution was interrupted
3 rows in set (0.00 sec)
[9 Apr 2012 18:53] Shane Bester
https://github.com/twitter/mysql/wiki/Change-History#wiki-5.5.21.t4
"Bug#64556: Interrupting a query inside InnoDB causes an unrelated warning to be raised

Interrupting a statement (with KILL QUERY) that is executing inside InnoDB leads to an unrelated warning being raised in the context of the connection whose statement was interrupted.
"
[20 Dec 2013 11:14] Erlend Dahl
[10 Jul 2013 11:29] Daniel T Price (DTPRICE)

Fixed in 5.5.34, 5.6.14, 5.7.2 under the heading of Bug#16710923. 	

"A regression introduced with the fix for Bug #11762038 would cause
"InnoDB" to raise an incorrect error message. The message stated that,
"InnoDB cannot delete/update rows with cascading foreign key constraints
that exceed max depth of 20". The error message would occur when killing
connections reading from "InnoDB" tables that did not have foreign key
constraints."