MWL#182: Explain running statements

- Remove out-of-date comments, add dbug assertions.
This commit is contained in:
Sergey Petrunya 2012-06-25 18:39:26 +04:00
parent 45503698c1
commit 66c62de103
6 changed files with 8 additions and 18 deletions

View File

@ -1242,11 +1242,6 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
status_var_increment(thd->status_var.filesort_merge_passes);
thd->query_plan_fsort_passes++;
/*if (param->not_killable)
{
killed= &not_killable;
not_killable= NOT_KILLED;
}*/
error=0;
rec_length= param->rec_length;

View File

@ -86,7 +86,7 @@ void Apc_target::disable()
void Apc_target::enqueue_request(Call_request *qe)
{
//call_queue_size++;
mysql_mutex_assert_owner(LOCK_thd_data_ptr);
if (apc_calls)
{
Call_request *after= apc_calls->prev;
@ -112,12 +112,11 @@ void Apc_target::enqueue_request(Call_request *qe)
void Apc_target::dequeue_request(Call_request *qe)
{
//call_queue_size--;
mysql_mutex_assert_owner(LOCK_thd_data_ptr);
if (apc_calls == qe)
{
if ((apc_calls= apc_calls->next) == qe)
{
//DBUG_ASSERT(!call_queue_size);
apc_calls= NULL;
}
}

View File

@ -28,7 +28,7 @@ class Apc_target
{
mysql_mutex_t *LOCK_thd_data_ptr;
public:
Apc_target() : enabled(0), apc_calls(NULL) /*, call_queue_size(0)*/ {}
Apc_target() : enabled(0), apc_calls(NULL) {}
~Apc_target() { DBUG_ASSERT(!enabled && !apc_calls);}
void init(mysql_mutex_t *target_mutex);

View File

@ -3333,12 +3333,14 @@ void THD::restore_active_arena(Query_arena *set, Query_arena *backup)
void Show_explain_request::get_explain_data(void *arg)
{
Show_explain_request *req= (Show_explain_request*)arg;
//TODO: change mem_root to point to request_thd->mem_root.
// Actually, change the ARENA, because we're going to allocate items!
Query_arena backup_arena;
THD *target_thd= req->target_thd;
bool printed_anything= FALSE;
/*
Change the arena because JOIN::print_explain and co. are going to allocate
items. Let them allocate them on our arena.
*/
target_thd->set_n_backup_active_arena((Query_arena*)req->request_thd,
&backup_arena);

View File

@ -10321,12 +10321,7 @@ void JOIN_TAB::cleanup()
if (cache)
{
cache->free();
cache= 0; // psergey: this is why we don't see "Using join cache" in SHOW EXPLAIN
// when it is run for "Using temporary+filesort" queries while they
// are at reading-from-tmp-table phase.
//
// TODO ask igor if this can be just moved to later phase
// (JOIN_CACHE objects themselves are not big, arent they)
cache= 0;
}
limit= 0;
if (table)

View File

@ -2092,7 +2092,6 @@ void mysqld_show_explain(THD *thd, ulong thread_id)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_YES, explain_req.query_str.c_ptr_safe());
}
//mysql_mutex_unlock(&tmp->LOCK_thd_data);
if (!bres)
{
explain_buf->flush_data();