BUG#665669: Result differences on query re-execution
- Cause: handler::in_range_check_pushed_down was not reset when a command would call handler->idx_cond_push() without later calling handler->index_end(). - Fix: reset the variable in handler->reset(), too (like we do with other Index Condition Pushdown members).
This commit is contained in:
parent
cb4fa7f401
commit
ad78c24a20
@ -660,3 +660,24 @@ count(*) sum(table1.col_int_key*table2.pk)
|
||||
drop table t1,t2;
|
||||
set join_cache_level=@my_save_join_cache_level;
|
||||
set join_buffer_size=@my_save_join_buffer_size;
|
||||
#
|
||||
# BUG#665669: Result differences on query re-execution
|
||||
#
|
||||
create table t1 (pk int primary key, b int, c int default 0, index idx(b)) engine=innodb;
|
||||
insert into t1(pk,b) values (3, 30), (2, 20), (9, 90), (7, 70), (4, 40), (5, 50), (10, 100), (12, 120);
|
||||
set @my_save_optimizer_use_mrr=@@optimizer_use_mrr;
|
||||
set optimizer_use_mrr='disable';
|
||||
explain select * from t1 where b > 1000;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range idx idx 5 NULL 1 Using index condition
|
||||
# The following two must produce indentical results:
|
||||
select * from t1 where pk < 2 or pk between 3 and 4;
|
||||
pk b c
|
||||
3 30 0
|
||||
4 40 0
|
||||
select * from t1 where pk < 2 or pk between 3 and 4;
|
||||
pk b c
|
||||
3 30 0
|
||||
4 40 0
|
||||
drop table t1;
|
||||
set optimizer_use_mrr = @my_save_optimizer_use_mrr;
|
||||
|
@ -364,3 +364,18 @@ drop table t1,t2;
|
||||
set join_cache_level=@my_save_join_cache_level;
|
||||
set join_buffer_size=@my_save_join_buffer_size;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # BUG#665669: Result differences on query re-execution
|
||||
--echo #
|
||||
create table t1 (pk int primary key, b int, c int default 0, index idx(b)) engine=innodb;
|
||||
insert into t1(pk,b) values (3, 30), (2, 20), (9, 90), (7, 70), (4, 40), (5, 50), (10, 100), (12, 120);
|
||||
set @my_save_optimizer_use_mrr=@@optimizer_use_mrr;
|
||||
set optimizer_use_mrr='disable';
|
||||
explain select * from t1 where b > 1000;
|
||||
--echo # The following two must produce indentical results:
|
||||
select * from t1 where pk < 2 or pk between 3 and 4;
|
||||
select * from t1 where pk < 2 or pk between 3 and 4;
|
||||
drop table t1;
|
||||
set optimizer_use_mrr = @my_save_optimizer_use_mrr;
|
||||
|
||||
|
@ -2456,6 +2456,7 @@ int ha_maria::reset(void)
|
||||
{
|
||||
pushed_idx_cond= NULL;
|
||||
pushed_idx_cond_keyno= MAX_KEY;
|
||||
in_range_check_pushed_down= FALSE;
|
||||
ma_set_index_cond_func(file, NULL, 0);
|
||||
ds_mrr.dsmrr_close();
|
||||
if (file->trn)
|
||||
|
@ -1929,6 +1929,7 @@ int ha_myisam::reset(void)
|
||||
{
|
||||
pushed_idx_cond= NULL;
|
||||
pushed_idx_cond_keyno= MAX_KEY;
|
||||
in_range_check_pushed_down= FALSE;
|
||||
mi_set_index_cond_func(file, NULL, 0);
|
||||
ds_mrr.dsmrr_close();
|
||||
return mi_reset(file);
|
||||
|
@ -8865,6 +8865,7 @@ ha_innobase::extra(
|
||||
pushed_idx_cond= FALSE;
|
||||
pushed_idx_cond_keyno= MAX_KEY;
|
||||
prebuilt->idx_cond_func= NULL;
|
||||
in_range_check_pushed_down= FALSE;
|
||||
break;
|
||||
case HA_EXTRA_NO_KEYREAD:
|
||||
prebuilt->read_just_key = 0;
|
||||
@ -8915,6 +8916,7 @@ ha_innobase::reset()
|
||||
/* Reset index condition pushdown state */
|
||||
pushed_idx_cond_keyno= MAX_KEY;
|
||||
pushed_idx_cond= NULL;
|
||||
in_range_check_pushed_down= FALSE;
|
||||
ds_mrr.dsmrr_close();
|
||||
prebuilt->idx_cond_func= NULL;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user