1
0
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:
Oleksandr Byelkin
2023-11-08 12:59:00 +01:00
396 changed files with 10324 additions and 5797 deletions

View File

@ -1639,7 +1639,7 @@ bool JOIN_CACHE::get_record()
pos+= referenced_fields*size_of_fld_ofs;
if (prev_cache)
prev_cache->get_record_by_pos(prev_rec_ptr);
}
}
return res;
}
@ -2055,10 +2055,11 @@ bool JOIN_CACHE::skip_if_matched()
- In the case of a semi-nest the match flag may be in two states
{MATCH_NOT_FOUND, MATCH_FOUND}. The record is skipped if the flag is set
to MATCH_FOUND.
- In the case of a outer join nest when not_exists optimization is applied
the match may be in three states {MATCH_NOT_FOUND, MATCH_IMPOSSIBLE,
MATCH_FOUND. The record is skipped if the flag is set to MATCH_FOUND or
to MATCH_IMPOSSIBLE.
- In the case of an outer join the match may be in three states
{MATCH_NOT_FOUND, MATCH_IMPOSSIBLE, MATCH_FOUND}.
If not_exists optimization is applied the record is skipped when
the flag is set to MATCH_FOUND or to MATCH_IMPOSSIBLE. Otherwise
the record is skipped only when the flag is set to MATCH_IMPOSSIBLE.
If the record is skipped the value of 'pos' is set to point to the position
right after the record.
@ -2081,13 +2082,13 @@ bool JOIN_CACHE::skip_if_not_needed_match()
if (prev_cache)
offset+= prev_cache->get_size_of_rec_offset();
if (!join_tab->check_only_first_match())
return FALSE;
match_fl= get_match_flag_by_pos(pos+offset);
skip= join_tab->first_sj_inner_tab ?
match_fl == MATCH_FOUND : // the case of semi-join
match_fl != MATCH_NOT_FOUND; // the case of outer-join
match_fl == MATCH_FOUND : // the case of semi-join
not_exists_opt_is_applicable &&
join_tab->table->reginfo.not_exists_optimize ?
match_fl != MATCH_NOT_FOUND : // the case of not exist opt
match_fl == MATCH_IMPOSSIBLE;
if (skip)
{
@ -2344,7 +2345,11 @@ enum_nested_loop_state JOIN_CACHE::join_matching_records(bool skip_last)
if ((rc= join_tab_execution_startup(join_tab)) < 0)
goto finish2;
join_tab->build_range_rowid_filter_if_needed();
if (join_tab->build_range_rowid_filter_if_needed())
{
rc= NESTED_LOOP_ERROR;
goto finish2;
}
/* Prepare to retrieve all records of the joined table */
if (unlikely((error= join_tab_scan->open())))
@ -2385,7 +2390,7 @@ enum_nested_loop_state JOIN_CACHE::join_matching_records(bool skip_last)
as candidates for matches.
*/
bool not_exists_opt_is_applicable= true;
not_exists_opt_is_applicable= true;
if (check_only_first_match && join_tab->first_inner)
{
/*
@ -2410,11 +2415,14 @@ enum_nested_loop_state JOIN_CACHE::join_matching_records(bool skip_last)
}
}
if (!check_only_first_match ||
(join_tab->first_inner && !not_exists_opt_is_applicable) ||
if ((!join_tab->on_precond &&
(!check_only_first_match ||
(join_tab->first_inner && !not_exists_opt_is_applicable))) ||
!skip_next_candidate_for_match(rec_ptr))
{
read_next_candidate_for_match(rec_ptr);
ANALYZE_START_TRACKING(join->thd, join_tab->jbuf_unpack_tracker);
read_next_candidate_for_match(rec_ptr);
ANALYZE_STOP_TRACKING(join->thd, join_tab->jbuf_unpack_tracker);
rc= generate_full_extensions(rec_ptr);
if (rc != NESTED_LOOP_OK && rc != NESTED_LOOP_NO_MORE_ROWS)
goto finish;