Commit 9b269ea1 authored by Sergey Petrunya's avatar Sergey Petrunya

MWL#182: Explain running statements

- Correct thd->killed checks in join cache and filesort modules.
parent ca8aa390
......@@ -493,7 +493,7 @@ 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;
//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;
......@@ -588,7 +588,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
break;
}
if (*killed)
if (thd->check_killed())
{
DBUG_PRINT("info",("Sort killed by user"));
if (!indexfile && !quick_select)
......@@ -1229,18 +1229,20 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
void *first_cmp_arg;
element_count dupl_count= 0;
uchar *src;
killed_state not_killable;
/* killed_state not_killable; */
uchar *unique_buff= param->unique_buff;
volatile killed_state *killed= &current_thd->killed;
/* volatile killed_state *killed= &current_thd->killed; */
const bool killable= !param->not_killable;
THD* const thd=current_thd;
DBUG_ENTER("merge_buffers");
status_var_increment(current_thd->status_var.filesort_merge_passes);
current_thd->query_plan_fsort_passes++;
if (param->not_killable)
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;
......@@ -1317,7 +1319,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
while (queue.elements > 1)
{
if (*killed)
if (killable && thd->check_killed())
{
error= 1; goto err; /* purecov: inspected */
}
......
......@@ -2235,7 +2235,7 @@ enum_nested_loop_state JOIN_CACHE::join_matching_records(bool skip_last)
while (!(error= join_tab_scan->next()))
{
if (join->thd->killed)
if (join->thd->check_killed())
{
/* The user has aborted the execution of the query */
join->thd->send_kill_message();
......@@ -2505,7 +2505,7 @@ enum_nested_loop_state JOIN_CACHE::join_null_complements(bool skip_last)
for ( ; cnt; cnt--)
{
if (join->thd->killed)
if (join->thd->check_killed())
{
/* The user has aborted the execution of the query */
join->thd->send_kill_message();
......@@ -3355,7 +3355,7 @@ int JOIN_TAB_SCAN::next()
update_virtual_fields(thd, table);
while (!err && select && (skip_rc= select->skip_record(thd)) <= 0)
{
if (thd->killed || skip_rc < 0)
if (thd->check_killed() || skip_rc < 0)
return 1;
/*
Move to the next record if the last retrieved record does not
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment