[MDEV-30783] Different behaviour for SELECT and DO when KILL QUERY is used Created: 2023-03-04  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: 10.4, 10.5, 10.6, 10.11

Type: Bug Priority: Minor
Reporter: Christian Gonzalez Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: None


 Description   

The official documentation defines the KILL QUERY statement as:

KILL QUERY terminates the statement that the connection thread_id is currently executing, but leaves the connection itself intact.

and defines DO like:

DO executes the expressions but does not return any results. In most respects, DO is shorthand for SELECT expr, ..., 
but has the advantage that it is slightly faster when you do not care about the result.

Based on the documentation above, which doesn't defines what exactly is an statement, I would expect that at least both SELECT and DO are (or not) a statement (i.e both are treated the same way). But when executing something like:

CREATE EVENT sacrificial_zombie ON SCHEDULE AT CURRENT_TIMESTAMP DO
BEGIN 
  SELECT sleep(5);
  SELECT "Will never be printed if we KILL QUERY during SELECT sleep(5)";
  SELECT sleep(6);
END;

If the KILL QUERY is executed against the thread running the above event it will result on everything after SELECT sleep(5) not being executed. While if I execute something like:

CREATE EVENT sacrificial_zombie ON SCHEDULE AT CURRENT_TIMESTAMP DO BEGIN DO sleep(5); DO sleep(6); END;

and execute KILL QUERY against the thread running the event it will only terminates the execution of DO sleep(5); but the second part DO sleep(6) will be executed.


Generated at Thu Feb 08 10:18:51 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.