From 6a7f8af3f9ca95163cba3c7efdf04944378fb8d3 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Sat, 5 Oct 2013 10:25:59 +0400 Subject: [PATCH] MDEV-3798: EXPLAIN UPDATE/DELETE - Address review feedback: rename files --- libmysqld/CMakeLists.txt | 2 +- sql/CMakeLists.txt | 2 +- sql/{opt_qpf.cc => sql_explain.cc} | 0 sql/{opt_qpf.h => sql_explain.h} | 0 sql/sql_lex.cc | 10 ++++---- sql/sql_select.cc | 41 ++++++++++++------------------ sql/sql_select.h | 2 +- 7 files changed, 24 insertions(+), 33 deletions(-) rename sql/{opt_qpf.cc => sql_explain.cc} (100%) rename sql/{opt_qpf.h => sql_explain.h} (100%) diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index 856063afd95..87004897525 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -99,7 +99,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc ../sql/sql_expression_cache.cc ../sql/my_apc.cc ../sql/my_apc.h ../sql/rpl_gtid.cc - ../sql/opt_qpf.cc ../sql/opt_qpf.h + ../sql/sql_explain.cc ../sql/sql_explain.h ${GEN_SOURCES} ${MYSYS_LIBWRAP_SOURCE} ) diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 33f3816c297..9db6ba16c30 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -80,7 +80,7 @@ SET (SQL_SOURCE sql_reload.cc # added in MariaDB: - opt_qpf.h opt_qpf.cc + sql_explain.h sql_explain.cc sql_lifo_buffer.h sql_join_cache.h sql_join_cache.cc create_options.cc multi_range_read.cc opt_index_cond_pushdown.cc opt_subselect.cc diff --git a/sql/opt_qpf.cc b/sql/sql_explain.cc similarity index 100% rename from sql/opt_qpf.cc rename to sql/sql_explain.cc diff --git a/sql/opt_qpf.h b/sql/sql_explain.h similarity index 100% rename from sql/opt_qpf.h rename to sql/sql_explain.h diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 48c65e68f87..fd8d07f90aa 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -3516,14 +3516,14 @@ bool st_select_lex::optimize_unflattened_subqueries(bool const_only) inner_join->select_options= save_options; un->thd->lex->current_select= save_select; - Explain_query *qpf; - if ((qpf= inner_join->thd->lex->explain)) + Explain_query *eq; + if ((eq= inner_join->thd->lex->explain)) { - Explain_select *qp_sel; - if ((qp_sel= qpf->get_select(inner_join->select_lex->select_number))) + Explain_select *expl_sel; + if ((expl_sel= eq->get_select(inner_join->select_lex->select_number))) { sl->set_explain_type(TRUE); - qp_sel->select_type= sl->type; + expl_sel->select_type= sl->type; } } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index e7557b92ea4..c87470b5e37 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2328,14 +2328,6 @@ void join_save_qpf(JOIN *join) void JOIN::exec() { - /* - Enable SHOW EXPLAIN only if we're in the top-level query. - */ - - /* - psergey: we can produce SHOW explain at this point. This means, we're ready - to save the query plan. - */ thd->apc_target.enable(); DBUG_EXECUTE_IF("show_explain_probe_join_exec_start", if (dbug_user_var_equals_int(thd, @@ -2343,7 +2335,6 @@ void JOIN::exec() select_lex->select_number)) dbug_serve_apcs(thd, 1); ); - exec_inner(); if (!exec_saved_explain) @@ -22505,15 +22496,15 @@ int JOIN::save_explain_data(Explain_query *output, bool need_tmp_table, if (message) { - Explain_select *qp_sel; - qp_node= qp_sel= new (output->mem_root) Explain_select; + Explain_select *xpl_sel; + qp_node= xpl_sel= new (output->mem_root) Explain_select; join->select_lex->set_explain_type(true); - qp_sel->select_id= join->select_lex->select_number; - qp_sel->select_type= join->select_lex->type; - qp_sel->message= message; - /* Setting qp_sel->message means that all other members are invalid */ - output->add_node(qp_sel); + xpl_sel->select_id= join->select_lex->select_number; + xpl_sel->select_type= join->select_lex->type; + xpl_sel->message= message; + /* Setting xpl_sel->message means that all other members are invalid */ + output->add_node(xpl_sel); } else if (join->select_lex == join->unit->fake_select_lex) { @@ -22522,13 +22513,13 @@ int JOIN::save_explain_data(Explain_query *output, bool need_tmp_table, else if (!join->select_lex->master_unit()->derived || join->select_lex->master_unit()->derived->is_materialized_derived()) { - Explain_select *qp_sel; - qp_node= qp_sel= new (output->mem_root) Explain_select; + Explain_select *xpl_sel; + qp_node= xpl_sel= new (output->mem_root) Explain_select; table_map used_tables=0; join->select_lex->set_explain_type(true); - qp_sel->select_id= join->select_lex->select_number; - qp_sel->select_type= join->select_lex->type; + xpl_sel->select_id= join->select_lex->select_number; + xpl_sel->select_type= join->select_lex->type; JOIN_TAB* const first_top_tab= first_breadth_first_tab(join, WALK_OPTIMIZATION_TABS); @@ -22572,7 +22563,7 @@ int JOIN::save_explain_data(Explain_query *output, bool need_tmp_table, } Explain_table_access *qpt= new (output->mem_root) Explain_table_access; - qp_sel->add_table(qpt); + xpl_sel->add_table(qpt); qpt->key.set(thd->mem_root, NULL, (uint)-1); qpt->quick_info= NULL; @@ -22583,7 +22574,7 @@ int JOIN::save_explain_data(Explain_query *output, bool need_tmp_table, qpt->sjm_nest_select_id= 0; /* select_type */ - qp_sel->select_type= join->select_lex->type; + xpl_sel->select_type= join->select_lex->type; /* table */ if (table->derived_select_number) @@ -22893,12 +22884,12 @@ int JOIN::save_explain_data(Explain_query *output, bool need_tmp_table, if (need_tmp_table) { need_tmp_table=0; - qp_sel->using_temporary= true; + xpl_sel->using_temporary= true; } if (need_order) { need_order=0; - qp_sel->using_filesort= true; + xpl_sel->using_filesort= true; } if (distinct & test_all_bits(used_tables, join->select_list_used_tables)) @@ -22956,7 +22947,7 @@ int JOIN::save_explain_data(Explain_query *output, bool need_tmp_table, // For next iteration used_tables|=table->map; } - output->add_node(qp_sel); + output->add_node(xpl_sel); } for (SELECT_LEX_UNIT *unit= join->select_lex->first_inner_unit(); diff --git a/sql/sql_select.h b/sql/sql_select.h index fc2ffb3c175..d6e133262f1 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -198,7 +198,7 @@ int rr_sequential(READ_RECORD *info); int rr_sequential_and_unpack(READ_RECORD *info); -#include "opt_qpf.h" +#include "sql_explain.h" /************************************************************************************** * New EXPLAIN structures END