mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
my_alloc.c
- Changed 0x%lx -> %p array.c: - Static (preallocated) buffer can now be anywhere my_sys.h - Define MY_INIT_BUFFER_USED sql_delete.cc & sql_lex.cc - Use memroot when allocating classes (avoids call to current_thd) sql_explain.h: - Use preallocated buffers sql_explain.cc: - Use preallocated buffers and memroot sql_select.cc: - Use multi_alloc_root() instead of many alloc_root() - Update calls to Explain
This commit is contained in:
@ -27,10 +27,11 @@ const char * STR_DELETING_ALL_ROWS= "Deleting all rows";
|
||||
const char * STR_IMPOSSIBLE_WHERE= "Impossible WHERE";
|
||||
const char * STR_NO_ROWS_AFTER_PRUNING= "No matching rows after partition pruning";
|
||||
|
||||
Explain_query::Explain_query(THD *thd_arg) :
|
||||
upd_del_plan(NULL), insert_plan(NULL), thd(thd_arg), apc_enabled(false)
|
||||
Explain_query::Explain_query(THD *thd_arg, MEM_ROOT *root) :
|
||||
mem_root(root), upd_del_plan(NULL), insert_plan(NULL),
|
||||
unions(root), selects(root), thd(thd_arg), apc_enabled(false),
|
||||
operations(0)
|
||||
{
|
||||
operations= 0;
|
||||
}
|
||||
|
||||
|
||||
@ -140,7 +141,7 @@ int Explain_query::send_explain(THD *thd)
|
||||
select_result *result;
|
||||
LEX *lex= thd->lex;
|
||||
|
||||
if (!(result= new select_send()) ||
|
||||
if (!(result= new (thd->mem_root) select_send()) ||
|
||||
thd->send_explain_fields(result, lex->describe, lex->analyze_stmt))
|
||||
return 1;
|
||||
|
||||
@ -225,7 +226,8 @@ bool print_explain_for_slow_log(LEX *lex, THD *thd, String *str)
|
||||
Return tabular EXPLAIN output as a text string
|
||||
*/
|
||||
|
||||
bool Explain_query::print_explain_str(THD *thd, String *out_str, bool is_analyze)
|
||||
bool Explain_query::print_explain_str(THD *thd, String *out_str,
|
||||
bool is_analyze)
|
||||
{
|
||||
List<Item> fields;
|
||||
thd->make_explain_field_list(fields, thd->lex->describe, is_analyze);
|
||||
@ -551,6 +553,20 @@ int Explain_node::print_explain_for_children(Explain_query *query,
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Explain_basic_join::add_table(Explain_table_access *tab, Explain_query *query)
|
||||
{
|
||||
if (!join_tabs)
|
||||
{
|
||||
n_join_tabs= 0;
|
||||
if (!(join_tabs= ((Explain_table_access**)
|
||||
alloc_root(query->mem_root,
|
||||
sizeof(Explain_table_access*) *
|
||||
MAX_TABLES))))
|
||||
return true;
|
||||
}
|
||||
join_tabs[n_join_tabs++]= tab;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
This tells whether a child subquery should be printed in JSON output.
|
||||
@ -609,7 +625,6 @@ Explain_basic_join::~Explain_basic_join()
|
||||
{
|
||||
for (uint i= 0; i< n_join_tabs; i++)
|
||||
delete join_tabs[i];
|
||||
my_free(join_tabs);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1895,9 +1910,12 @@ void delete_explain_query(LEX *lex)
|
||||
void create_explain_query(LEX *lex, MEM_ROOT *mem_root)
|
||||
{
|
||||
DBUG_ASSERT(!lex->explain);
|
||||
lex->explain= new Explain_query(lex->thd);
|
||||
DBUG_ENTER("create_explain_query");
|
||||
|
||||
lex->explain= new (mem_root) Explain_query(lex->thd, mem_root);
|
||||
DBUG_ASSERT(mem_root == current_thd->mem_root);
|
||||
lex->explain->mem_root= mem_root;
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
void create_explain_query_if_not_exists(LEX *lex, MEM_ROOT *mem_root)
|
||||
|
Reference in New Issue
Block a user