Commit e6373551 authored by Sergei Petrunia's avatar Sergei Petrunia

MDEV-21610 Different query results from 10.4.11 to 10.4.12

Part#2: cleanup:

In the part 1 of the fix, DS-MRR implementation would peek into
the JOIN_TAB to get the rowid filter from

  table->reginfo.join_tab->rowid_filter

This doesn't look good from code isolation standpoint (why should a
storage engine assume it is used through a JOIN_TAB?).

Fixed this by storing the 'un-pushed' rowid_filter in the DsMrr_impl
structure. The filter survives across multi_range_read_init() calls.

It is discarded when somebody calls index_end() or rnd_end() and cleans
up the DsMrr_impl.
parent adcfea71
...@@ -1015,6 +1015,7 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs, ...@@ -1015,6 +1015,7 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
primary key. Use the rowid filter outside the engine code (see primary key. Use the rowid filter outside the engine code (see
Mrr_ordered_rndpos_reader::refill_from_index_reader). Mrr_ordered_rndpos_reader::refill_from_index_reader).
*/ */
rowid_filter= h_arg->pushed_rowid_filter;
h_arg->cancel_pushed_rowid_filter(); h_arg->cancel_pushed_rowid_filter();
} }
} }
...@@ -1096,15 +1097,18 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs, ...@@ -1096,15 +1097,18 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
goto use_default_impl; goto use_default_impl;
} }
// setup_two_handlers() will call dsmrr_close() will clears the filter.
// Save its value and restore afterwards.
Rowid_filter *tmp = rowid_filter;
if ((res= setup_two_handlers())) if ((res= setup_two_handlers()))
goto error; goto error;
rowid_filter= tmp;
if ((res= index_strategy->init(secondary_file, seq_funcs, seq_init_param, if ((res= index_strategy->init(secondary_file, seq_funcs, seq_init_param,
n_ranges, mode, &keypar, key_buffer, n_ranges, mode, &keypar, key_buffer,
&buf_manager)) || &buf_manager)) ||
(res= disk_strategy->init(primary_file, index_strategy, mode, (res= disk_strategy->init(primary_file, index_strategy, mode,
&rowid_buffer, &rowid_buffer, rowid_filter)))
table->reginfo.join_tab->rowid_filter)))
{ {
goto error; goto error;
} }
...@@ -1286,6 +1290,7 @@ void DsMrr_impl::close_second_handler() ...@@ -1286,6 +1290,7 @@ void DsMrr_impl::close_second_handler()
void DsMrr_impl::dsmrr_close() void DsMrr_impl::dsmrr_close()
{ {
DBUG_ENTER("DsMrr_impl::dsmrr_close"); DBUG_ENTER("DsMrr_impl::dsmrr_close");
rowid_filter= NULL;
close_second_handler(); close_second_handler();
strategy= NULL; strategy= NULL;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
......
...@@ -557,7 +557,8 @@ class DsMrr_impl ...@@ -557,7 +557,8 @@ class DsMrr_impl
typedef void (handler::*range_check_toggle_func_t)(bool on); typedef void (handler::*range_check_toggle_func_t)(bool on);
DsMrr_impl() DsMrr_impl()
: secondary_file(NULL) {}; : secondary_file(NULL),
rowid_filter(NULL) {};
void init(handler *h_arg, TABLE *table_arg) void init(handler *h_arg, TABLE *table_arg)
{ {
...@@ -594,7 +595,13 @@ class DsMrr_impl ...@@ -594,7 +595,13 @@ class DsMrr_impl
to run both index scan and rnd_pos() scan at the same time) to run both index scan and rnd_pos() scan at the same time)
*/ */
handler *secondary_file; handler *secondary_file;
/*
The rowid filter that DS-MRR has "unpushed" from the storage engine.
If it's present, DS-MRR will use it.
*/
Rowid_filter *rowid_filter;
uint keyno; /* index we're running the scan on */ uint keyno; /* index we're running the scan on */
/* TRUE <=> need range association, buffers hold {rowid, range_id} pairs */ /* TRUE <=> need range association, buffers hold {rowid, range_id} pairs */
bool is_mrr_assoc; bool is_mrr_assoc;
......
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