Description:
When a query failed by killing, the error ER_QUERY_INTERRUPTED in some circumstances are not propagated to the upper level, and result in obscure error or even incorrect error. So when a query is killed, the error code can be something other than ER_QUERY_INTERRUPTED, which can confuse user and misleading.
For example:
--------------------------------------------------------------------------------------
connect (master, 127.0.0.1, root, , test, $MASTER_MYPORT);
connect (master1, 127.0.0.1, root, , test, $MASTER_MYPORT);
connection master1;
let $con_id= `select connection_id()`;
create function f1() returns int
return 0;
send alter function f1 SQL SECURITY INVOKER;
connection master;
eval kill query $con_id;
connection master1;
reap;
--------------------------------------------------------------------------------------
Run this test case will mostly result in error ER_SP_CANT_ALTER, which is not quite clear about what happend. And sometimes if the killing happens while searching for the function, the error code can be ER_SP_DOES_NOT_EXIST, which is totally misleading.
This problem exists for some other DDL statements too, but I have not tested DML or other statements if they suffer this problem or not.
I think BUG#31807 probably is one instance of this problem.
How to repeat:
See description.
Suggested fix:
I think if the query was failed due to kill, the error code should always be ER_QUERY_INTERRUPTED, this error code should be propagated properly to upper level.