[MDEV-33423] show_analyze sporadically fails at line 226: query 'reap' succeeded - should have failed with error ER_QUERY_INTERRUPTED Created: 2024-02-07  Updated: 2024-02-08

Status: In Review
Project: MariaDB Server
Component/s: Tests
Affects Version/s: 10.11
Fix Version/s: 10.11

Type: Bug Priority: Major
Reporter: Sergei Petrunia Assignee: Dave Gosselin
Resolution: Unresolved Votes: 0
Labels: tests


 Description   

CURRENT_TEST: main.show_analyze
mysqltest: At line 226: query 'reap' succeeded - should have failed with error ER_QUERY_INTERRUPTED (1317)...
 
The result from queries just before the failure was:
< snip >
id	select_type	table	type	possible_keys	key	key_len	ref	rows	r_rows	filtered	r_filtered	Extra
1	PRIMARY	a	ALL	NULL	NULL	NULL	NULL	10	10.00	100.00	20.00	Using where
2	DEPENDENT SUBQUERY	b	ALL	NULL	NULL	NULL	NULL	10	10.00	100.00	95.00	Using where
Warnings:
Note	1003	analyze select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2
connection con1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	r_rows	filtered	r_filtered	Extra
1	PRIMARY	a	ALL	NULL	NULL	NULL	NULL	10	10.00	100.00	20.00	Using where
2	DEPENDENT SUBQUERY	b	ALL	NULL	NULL	NULL	NULL	10	10.00	100.00	95.00	Using where
SET debug_dbug=@old_debug;
# Try to do SHOW ANALYZE for a query that runs a  SET command:
#
set @show_explain_probe_select_id=2;
SET debug_dbug='+d,show_explain_probe_join_exec_start';
set @foo= (select max(a) from t0 where sin(a) >0);
connection default;
show analyze for $thr2;
ERROR HY000: Target is not executing an operation with a query plan
kill query $thr2;
connection con1;

The portion of the test that is failing:

--echo # Try to do SHOW ANALYZE for a query that runs a  SET command:
--echo #
set @show_explain_probe_select_id=2; # <---
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send set @foo= (select max(a) from t0 where sin(a) >0);
connection default;
--source include/wait_condition.inc
--error ER_TARGET_NOT_EXPLAINABLE
evalp show analyze for $thr2;
evalp kill query $thr2;
connection con1;
--error ER_QUERY_INTERRUPTED
reap;
SET debug_dbug=@old_debug;



 Comments   
Comment by Sergei Petrunia [ 2024-02-07 ]

How it executes:
connection con1 submits a query: set @foo= (select max(a) from t0 where sin(a) >0);
It starts executing and gets stuck at show_explain_probe_join_exec_start where it waits for an async call.
connection default runs: show analyze for $thr2; This returns ER_TARGET_NOT_EXPLAINABLE.
This unblocks the {{set @foo= ...} query.
In failing scenario, the {{set @foo=.. } query continues and finishes execution.
In success scenario, it proceeds slowly
connection default runs: kill query $thr2;
In success scenario, it finds and kills the set @foo.. query. The query returns ER_QUERY_INTERRUPTED
In failing scenario, the set @foo... query has already finished. It returns OK and we get the error: 'reap' succeeded - should have failed with error ER_QUERY_INTERRUPTED

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