mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MWL#182: Explain running statements
- Correct thd->killed checks in join cache and filesort modules.
This commit is contained in:
@ -493,7 +493,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
|
|||||||
my_off_t record;
|
my_off_t record;
|
||||||
TABLE *sort_form;
|
TABLE *sort_form;
|
||||||
THD *thd= current_thd;
|
THD *thd= current_thd;
|
||||||
volatile killed_state *killed= &thd->killed;
|
//volatile killed_state *killed= &thd->killed;
|
||||||
handler *file;
|
handler *file;
|
||||||
MY_BITMAP *save_read_set, *save_write_set, *save_vcol_set;
|
MY_BITMAP *save_read_set, *save_write_set, *save_vcol_set;
|
||||||
uchar *next_sort_key= sort_keys_buf;
|
uchar *next_sort_key= sort_keys_buf;
|
||||||
@ -588,7 +588,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*killed)
|
if (thd->check_killed())
|
||||||
{
|
{
|
||||||
DBUG_PRINT("info",("Sort killed by user"));
|
DBUG_PRINT("info",("Sort killed by user"));
|
||||||
if (!indexfile && !quick_select)
|
if (!indexfile && !quick_select)
|
||||||
@ -1229,18 +1229,20 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
|
|||||||
void *first_cmp_arg;
|
void *first_cmp_arg;
|
||||||
element_count dupl_count= 0;
|
element_count dupl_count= 0;
|
||||||
uchar *src;
|
uchar *src;
|
||||||
killed_state not_killable;
|
/* killed_state not_killable; */
|
||||||
uchar *unique_buff= param->unique_buff;
|
uchar *unique_buff= param->unique_buff;
|
||||||
volatile killed_state *killed= ¤t_thd->killed;
|
/* volatile killed_state *killed= ¤t_thd->killed; */
|
||||||
|
const bool killable= !param->not_killable;
|
||||||
|
THD* const thd=current_thd;
|
||||||
DBUG_ENTER("merge_buffers");
|
DBUG_ENTER("merge_buffers");
|
||||||
|
|
||||||
status_var_increment(current_thd->status_var.filesort_merge_passes);
|
status_var_increment(thd->status_var.filesort_merge_passes);
|
||||||
current_thd->query_plan_fsort_passes++;
|
thd->query_plan_fsort_passes++;
|
||||||
if (param->not_killable)
|
/*if (param->not_killable)
|
||||||
{
|
{
|
||||||
killed= ¬_killable;
|
killed= ¬_killable;
|
||||||
not_killable= NOT_KILLED;
|
not_killable= NOT_KILLED;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
error=0;
|
error=0;
|
||||||
rec_length= param->rec_length;
|
rec_length= param->rec_length;
|
||||||
@ -1317,7 +1319,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
|
|||||||
|
|
||||||
while (queue.elements > 1)
|
while (queue.elements > 1)
|
||||||
{
|
{
|
||||||
if (*killed)
|
if (killable && thd->check_killed())
|
||||||
{
|
{
|
||||||
error= 1; goto err; /* purecov: inspected */
|
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()))
|
while (!(error= join_tab_scan->next()))
|
||||||
{
|
{
|
||||||
if (join->thd->killed)
|
if (join->thd->check_killed())
|
||||||
{
|
{
|
||||||
/* The user has aborted the execution of the query */
|
/* The user has aborted the execution of the query */
|
||||||
join->thd->send_kill_message();
|
join->thd->send_kill_message();
|
||||||
@ -2505,7 +2505,7 @@ enum_nested_loop_state JOIN_CACHE::join_null_complements(bool skip_last)
|
|||||||
|
|
||||||
for ( ; cnt; cnt--)
|
for ( ; cnt; cnt--)
|
||||||
{
|
{
|
||||||
if (join->thd->killed)
|
if (join->thd->check_killed())
|
||||||
{
|
{
|
||||||
/* The user has aborted the execution of the query */
|
/* The user has aborted the execution of the query */
|
||||||
join->thd->send_kill_message();
|
join->thd->send_kill_message();
|
||||||
@ -3355,7 +3355,7 @@ int JOIN_TAB_SCAN::next()
|
|||||||
update_virtual_fields(thd, table);
|
update_virtual_fields(thd, table);
|
||||||
while (!err && select && (skip_rc= select->skip_record(thd)) <= 0)
|
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;
|
return 1;
|
||||||
/*
|
/*
|
||||||
Move to the next record if the last retrieved record does not
|
Move to the next record if the last retrieved record does not
|
||||||
|
Reference in New Issue
Block a user