1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

SHOW EXPLAIN: Code cleanup

This commit is contained in:
Sergey Petrunya
2012-06-08 02:19:36 +04:00
parent 950dc8022e
commit cf8461a0f7
6 changed files with 10 additions and 18 deletions

View File

@ -502,7 +502,6 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
my_off_t record;
TABLE *sort_form;
THD *thd= current_thd;
//volatile killed_state *killed= &thd->killed;
handler *file;
MY_BITMAP *save_read_set, *save_write_set, *save_vcol_set;
uchar *next_sort_key= sort_keys_buf;
@ -1236,9 +1235,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
void *first_cmp_arg;
element_count dupl_count= 0;
uchar *src;
/* killed_state not_killable; */
uchar *unique_buff= param->unique_buff;
/* volatile killed_state *killed= &current_thd->killed; */
const bool killable= !param->not_killable;
THD* const thd=current_thd;
DBUG_ENTER("merge_buffers");

View File

@ -4725,7 +4725,6 @@ int subselect_hash_sj_engine::exec()
thd->lex->current_select= materialize_engine->select_lex;
/* The subquery should be optimized, and materialized only once. */
DBUG_ASSERT(materialize_join->optimized && !is_materialized);
materialize_join->exec();
if ((res= test(materialize_join->error || thd->is_fatal_error ||
thd->is_error())))

View File

@ -53,8 +53,7 @@ public:
int timeout_sec, bool *timed_out);
#ifndef DBUG_OFF
int n_calls_processed;
//int call_queue_size;
int n_calls_processed; /* Number of calls served by this target */
#endif
private:
class Call_request;

View File

@ -1656,7 +1656,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
while ((ifm= li++))
parent_lex->ftfunc_list->push_front(ifm);
}
parent_lex->have_merged_subqueries= TRUE;
DBUG_RETURN(FALSE);
}

View File

@ -1361,7 +1361,7 @@ void THD::cleanup(void)
mysql_mutex_unlock(&LOCK_user_locks);
ull= NULL;
}
apc_target.destroy();
cleanup_done=1;
DBUG_VOID_RETURN;
@ -1372,8 +1372,6 @@ THD::~THD()
{
THD_CHECK_SENTRY(this);
DBUG_ENTER("~THD()");
//psergey-todo: assert that the queue is disabled and empty.
/* Ensure that no one is using THD */
mysql_mutex_lock(&LOCK_thd_data);
mysys_var=0; // Safety (shouldn't be needed)
@ -2311,8 +2309,8 @@ int select_send::send_data(List<Item> &items)
DBUG_RETURN(0);
}
//////////////////////////////////////////////////////////////////////////////
int select_result_explain_buffer::send_data(List<Item> &items)
{
List_iterator_fast<Item> li(items);
@ -2336,13 +2334,16 @@ int select_result_explain_buffer::send_data(List<Item> &items)
*/
buffer.set(buff, sizeof(buff), &my_charset_bin);
}
//TODO: do we need the following:
if (thd->is_error())
{
protocol->remove_last_row();
DBUG_RETURN(1);
}
/* psergey-TODO: instead of protocol->write(), steal the packet here */
/*
Instead of calling protocol->write(), steal the packed and put it to our
buffer
*/
const char *packet_data;
size_t len;
protocol->get_packet(&packet_data, &len);

View File

@ -2228,7 +2228,7 @@ void JOIN::exec_inner()
List<Item> *columns_list= &fields_list;
int tmp_error;
DBUG_ENTER("JOIN::exec");
thd_proc_info(thd, "executing");
error= 0;
if (procedure)
@ -2526,16 +2526,12 @@ void JOIN::exec_inner()
/* Free first data from old join */
fprintf(stderr,"Q: %s\n", thd->query());
//DBUG_ASSERT(0);
/*
psergey-todo: this is the place of pre-mature JOIN::free call.
*/
curr_join->join_free();
//psergey-todo: SHOW EXPLAIN probe here
if (curr_join->make_simple_join(this, curr_tmp_table))
DBUG_VOID_RETURN;
//psergey-todo: SHOW EXPLAIN probe here
calc_group_buffer(curr_join, group_list);
count_field_types(select_lex, &curr_join->tmp_table_param,
curr_join->tmp_all_fields1,