Commit 60c55522 authored by Sergey Petrunya's avatar Sergey Petrunya

MDEV-5148: Server crashes in print_explain on killing EXPLAIN EXTENDED

- Make mysql_select() return error when the query was killed.
parent 5258e642
...@@ -1166,6 +1166,22 @@ SUM(b) ...@@ -1166,6 +1166,22 @@ SUM(b)
0 0
set debug_dbug=@old_debug; set debug_dbug=@old_debug;
DROP TABLE t1,t2; DROP TABLE t1,t2;
# End
drop table t0; drop table t0;
#
# MDEV-5148: Server crashes in print_explain on killing EXPLAIN EXTENDED
#
create table t0 (a int not null);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (a int, b int);
insert into t1 select a,a from t0;
create table t2 as select * from t1;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_best_ext_lim_search';
explain
select * from t0
where not exists ( select 1 from t1, t2 where t1.b=t2.b and t2.a=t0.a) and a is null;
kill query $thr2;
ERROR 70100: Query execution was interrupted
drop table t0,t1,t2;
# End
set debug_sync='RESET'; set debug_sync='RESET';
...@@ -1167,9 +1167,37 @@ reap; ...@@ -1167,9 +1167,37 @@ reap;
set debug_dbug=@old_debug; set debug_dbug=@old_debug;
DROP TABLE t1,t2; DROP TABLE t1,t2;
drop table t0;
--echo #
--echo # MDEV-5148: Server crashes in print_explain on killing EXPLAIN EXTENDED
--echo #
create table t0 (a int not null);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (a int, b int);
insert into t1 select a,a from t0;
create table t2 as select * from t1;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_best_ext_lim_search';
send
explain
select * from t0
where not exists ( select 1 from t1, t2 where t1.b=t2.b and t2.a=t0.a) and a is null;
connection default;
--source include/wait_condition.inc
evalp kill query $thr2;
connection con1;
--error ER_QUERY_INTERRUPTED
reap;
drop table t0,t1,t2;
--echo # End --echo # End
drop table t0;
connection default; connection default;
disconnect con1; disconnect con1;
set debug_sync='RESET'; set debug_sync='RESET';
......
...@@ -3200,7 +3200,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array, ...@@ -3200,7 +3200,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
select_result *result, SELECT_LEX_UNIT *unit, select_result *result, SELECT_LEX_UNIT *unit,
SELECT_LEX *select_lex) SELECT_LEX *select_lex)
{ {
bool err; int err= 0;
bool free_join= 1; bool free_join= 1;
DBUG_ENTER("mysql_select"); DBUG_ENTER("mysql_select");
...@@ -3294,7 +3294,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array, ...@@ -3294,7 +3294,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
err|= select_lex->cleanup(); err|= select_lex->cleanup();
DBUG_RETURN(err || thd->is_error()); DBUG_RETURN(err || thd->is_error());
} }
DBUG_RETURN(join->error); DBUG_RETURN(join->error ? join->error: err);
} }
...@@ -7412,6 +7412,14 @@ best_extension_by_limited_search(JOIN *join, ...@@ -7412,6 +7412,14 @@ best_extension_by_limited_search(JOIN *join,
DBUG_ENTER("best_extension_by_limited_search"); DBUG_ENTER("best_extension_by_limited_search");
THD *thd= join->thd; THD *thd= join->thd;
DBUG_EXECUTE_IF("show_explain_probe_best_ext_lim_search",
if (dbug_user_var_equals_int(thd,
"show_explain_probe_select_id",
join->select_lex->select_number))
dbug_serve_apcs(thd, 1);
);
if (thd->check_killed()) // Abort if (thd->check_killed()) // Abort
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment