summaryrefslogtreecommitdiff
path: root/sql/multi_range_read.cc
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2020-02-20 13:35:19 +0300
committerSergei Petrunia <psergey@askmonty.org>2020-02-20 13:35:19 +0300
commite637355156cb28388a291b0e3a5e9ee863b2854d (patch)
tree7da3533b7fb0f9d8194d931be984a7113a805e7c /sql/multi_range_read.cc
parentadcfea710ff0dcd8d223d41440225ebf6e64f796 (diff)
downloadmariadb-git-e637355156cb28388a291b0e3a5e9ee863b2854d.tar.gz
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.
Diffstat (limited to 'sql/multi_range_read.cc')
-rw-r--r--sql/multi_range_read.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc
index 51c3dc7a205..c000187626f 100644
--- a/sql/multi_range_read.cc
+++ b/sql/multi_range_read.cc
@@ -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
Mrr_ordered_rndpos_reader::refill_from_index_reader).
*/
+ rowid_filter= h_arg->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,
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()))
goto error;
+ rowid_filter= tmp;
if ((res= index_strategy->init(secondary_file, seq_funcs, seq_init_param,
n_ranges, mode, &keypar, key_buffer,
&buf_manager)) ||
(res= disk_strategy->init(primary_file, index_strategy, mode,
- &rowid_buffer,
- table->reginfo.join_tab->rowid_filter)))
+ &rowid_buffer, rowid_filter)))
{
goto error;
}
@@ -1286,6 +1290,7 @@ void DsMrr_impl::close_second_handler()
void DsMrr_impl::dsmrr_close()
{
DBUG_ENTER("DsMrr_impl::dsmrr_close");
+ rowid_filter= NULL;
close_second_handler();
strategy= NULL;
DBUG_VOID_RETURN;