1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-3798: EXPLAIN UPDATE/DELETE

Update the SHOW EXPLAIN code to work with the 
new architecture (part#1):
Before, SHOW EXPLAIN operated on real query plan structures, 
which meant it had to check when SELECTs are created/deleted.
SELECTs would call apc_target->enable() when they got a query 
plan and disable() when their query plan was deleted.

Now, Explain data structure becomes available at once (and we
call apc_target->enable()) and then it stays until it is deleted
(when that happens, we call apc_target->disable()).
This commit is contained in:
Sergey Petrunya
2013-10-14 20:09:33 +04:00
parent f67f8fd00f
commit 105e3ae6c9
11 changed files with 76 additions and 45 deletions

View File

@ -2298,8 +2298,6 @@ JOIN::save_join_tab()
void join_save_qpf(JOIN *join)
{
THD *thd= join->thd;
//TODO: why not call st_select_lex::save_qpf here?
if (join->select_lex->select_number != UINT_MAX &&
join->select_lex->select_number != INT_MAX /* this is not a UNION's "fake select */ &&
join->have_query_plan != JOIN::QEP_NOT_PRESENT_YET &&
@ -2315,7 +2313,7 @@ void join_save_qpf(JOIN *join)
/* It's a degenerate join */
message= join->zero_result_cause ? join->zero_result_cause : "No tables used";
}
join->save_explain_data(thd->lex->explain,
join->need_tmp,
!join->skip_sort_order && !join->no_order &&
@ -2328,7 +2326,6 @@ void join_save_qpf(JOIN *join)
void JOIN::exec()
{
thd->apc_target.enable();
DBUG_EXECUTE_IF("show_explain_probe_join_exec_start",
if (dbug_user_var_equals_int(thd,
"show_explain_probe_select_id",
@ -2368,7 +2365,6 @@ void JOIN::exec()
select_lex->select_number))
dbug_serve_apcs(thd, 1);
);
thd->apc_target.disable();
}
@ -22997,6 +22993,10 @@ int JOIN::save_explain_data(Explain_query *output, bool need_tmp_table,
}
}
if (!error && select_lex->is_top_level_node())
output->query_plan_ready();
DBUG_RETURN(error);
}