mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge branch '10.4' into 10.5
This commit is contained in:
@ -3074,6 +3074,14 @@ setup_subq_exit:
|
||||
}
|
||||
if (make_aggr_tables_info())
|
||||
DBUG_RETURN(1);
|
||||
|
||||
/*
|
||||
It could be that we've only done optimization stage 1 for
|
||||
some of the derived tables, and never did stage 2.
|
||||
Do it now, otherwise Explain data structure will not be complete.
|
||||
*/
|
||||
if (select_lex->handle_derived(thd->lex, DT_OPTIMIZE))
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
/*
|
||||
Even with zero matching rows, subqueries in the HAVING clause may
|
||||
@ -10491,7 +10499,10 @@ bool JOIN::get_best_combination()
|
||||
if (!(join_tab= (JOIN_TAB*) thd->alloc(sizeof(JOIN_TAB)*
|
||||
(top_join_tab_count + aggr_tables))))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
|
||||
if (inject_splitting_cond_for_all_tables_with_split_opt())
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
JOIN_TAB_RANGE *root_range;
|
||||
if (!(root_range= new (thd->mem_root) JOIN_TAB_RANGE))
|
||||
DBUG_RETURN(TRUE);
|
||||
@ -14546,8 +14557,6 @@ return_zero_rows(JOIN *join, select_result *result, List<TABLE_LIST> &tables,
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
join->join_free();
|
||||
|
||||
if (send_row)
|
||||
{
|
||||
/*
|
||||
@ -14594,6 +14603,14 @@ return_zero_rows(JOIN *join, select_result *result, List<TABLE_LIST> &tables,
|
||||
if (likely(!send_error))
|
||||
result->send_eof(); // Should be safe
|
||||
}
|
||||
/*
|
||||
JOIN::join_free() must be called after the virtual method
|
||||
select::send_result_set_metadata() returned control since
|
||||
implementation of this method could use data strutcures
|
||||
that are released by the method JOIN::join_free().
|
||||
*/
|
||||
join->join_free();
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
@ -18796,7 +18813,7 @@ bool Create_tmp_table::add_fields(THD *thd,
|
||||
*/
|
||||
item->marker == 4 || param->bit_fields_as_long,
|
||||
param->force_copy_fields);
|
||||
if (!new_field)
|
||||
if (unlikely(!new_field))
|
||||
{
|
||||
if (unlikely(thd->is_fatal_error))
|
||||
goto err; // Got OOM
|
||||
@ -21126,11 +21143,8 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
|
||||
*/
|
||||
if (shortcut_for_distinct && found_records != join->found_records)
|
||||
DBUG_RETURN(NESTED_LOOP_NO_MORE_ROWS);
|
||||
}
|
||||
else
|
||||
{
|
||||
join->thd->get_stmt_da()->inc_current_row_for_warning();
|
||||
join_tab->read_record.unlock_row(join_tab);
|
||||
|
||||
DBUG_RETURN(NESTED_LOOP_OK);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -21140,9 +21154,11 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
|
||||
with the beginning coinciding with the current partial join.
|
||||
*/
|
||||
join->join_examined_rows++;
|
||||
join->thd->get_stmt_da()->inc_current_row_for_warning();
|
||||
join_tab->read_record.unlock_row(join_tab);
|
||||
}
|
||||
|
||||
join->thd->get_stmt_da()->inc_current_row_for_warning();
|
||||
join_tab->read_record.unlock_row(join_tab);
|
||||
|
||||
DBUG_RETURN(NESTED_LOOP_OK);
|
||||
}
|
||||
|
||||
@ -22901,21 +22917,6 @@ make_cond_for_table_from_pred(THD *thd, Item *root_cond, Item *cond,
|
||||
cond->marker=3; // Checked when read
|
||||
return (COND*) 0;
|
||||
}
|
||||
/*
|
||||
If cond is an equality injected for split optimization then
|
||||
a. when retain_ref_cond == false : cond is removed unconditionally
|
||||
(cond that supports ref access is removed by the preceding code)
|
||||
b. when retain_ref_cond == true : cond is removed if it does not
|
||||
support ref access
|
||||
*/
|
||||
if (left_item->type() == Item::FIELD_ITEM &&
|
||||
is_eq_cond_injected_for_split_opt((Item_func_eq *) cond) &&
|
||||
(!retain_ref_cond ||
|
||||
!test_if_ref(root_cond, (Item_field*) left_item,right_item)))
|
||||
{
|
||||
cond->marker=3;
|
||||
return (COND*) 0;
|
||||
}
|
||||
}
|
||||
cond->marker=2;
|
||||
cond->set_join_tab_idx(join_tab_idx_arg);
|
||||
@ -29235,6 +29236,12 @@ AGGR_OP::end_send()
|
||||
table->reginfo.lock_type= TL_UNLOCK;
|
||||
|
||||
bool in_first_read= true;
|
||||
|
||||
/*
|
||||
Reset the counter before copying rows from internal temporary table to
|
||||
INSERT table.
|
||||
*/
|
||||
join_tab->join->thd->get_stmt_da()->reset_current_row_for_warning();
|
||||
while (rc == NESTED_LOOP_OK)
|
||||
{
|
||||
int error;
|
||||
|
Reference in New Issue
Block a user