1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-21495: Conditional jump or move depends on uninitialised value in sel_arg_range_seq_next

Initialize the parameter PARAM::max_key_part when we iterate over the ranges to get estimates
from EITS.
This commit is contained in:
Varun Gupta
2020-05-26 01:50:46 +05:30
parent cb9c49a9b2
commit 76f4ae8295
4 changed files with 43 additions and 0 deletions

View File

@ -1866,4 +1866,19 @@ id select_type table type possible_keys key key_len ref rows Extra
set optimizer_switch= @save_optimizer_switch;
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
drop table t1,t2;
#
# MDEV-21495: Conditional jump or move depends on uninitialised value in sel_arg_range_seq_next
#
CREATE TABLE t1(a INT, b INT);
INSERT INTO t1 SELECT seq, seq from seq_1_to_100;
set optimizer_use_condition_selectivity=4;
ANALYZE TABLE t1 PERSISTENT FOR ALL;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT * from t1 WHERE a = 5 and b = 5;
a b
5 5
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
drop table t1;
# End of 10.1 tests

View File

@ -1876,6 +1876,21 @@ id select_type table type possible_keys key key_len ref rows Extra
set optimizer_switch= @save_optimizer_switch;
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
drop table t1,t2;
#
# MDEV-21495: Conditional jump or move depends on uninitialised value in sel_arg_range_seq_next
#
CREATE TABLE t1(a INT, b INT);
INSERT INTO t1 SELECT seq, seq from seq_1_to_100;
set optimizer_use_condition_selectivity=4;
ANALYZE TABLE t1 PERSISTENT FOR ALL;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT * from t1 WHERE a = 5 and b = 5;
a b
5 5
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
drop table t1;
# End of 10.1 tests
set optimizer_switch=@save_optimizer_switch_for_selectivity_test;
set @tmp_ust= @@use_stat_tables;

View File

@ -1266,5 +1266,17 @@ set optimizer_switch= @save_optimizer_switch;
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
drop table t1,t2;
--echo #
--echo # MDEV-21495: Conditional jump or move depends on uninitialised value in sel_arg_range_seq_next
--echo #
CREATE TABLE t1(a INT, b INT);
INSERT INTO t1 SELECT seq, seq from seq_1_to_100;
set optimizer_use_condition_selectivity=4;
ANALYZE TABLE t1 PERSISTENT FOR ALL;
SELECT * from t1 WHERE a = 5 and b = 5;
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
drop table t1;
--echo # End of 10.1 tests

View File

@ -73,6 +73,7 @@ range_seq_t sel_arg_range_seq_init(void *init_param, uint n_ranges, uint flags)
{
SEL_ARG_RANGE_SEQ *seq= (SEL_ARG_RANGE_SEQ*)init_param;
seq->at_start= TRUE;
seq->param->max_key_part= 0;
seq->stack[0].key_tree= NULL;
seq->stack[0].min_key= seq->param->min_key;
seq->stack[0].min_key_flag= 0;