Skip to content

Commit 6491c59

Browse files
committed
Merge branch '10.0' into 10.1
2 parents 328d777 + daca7e7 commit 6491c59

File tree

8 files changed

+159
-64
lines changed

8 files changed

+159
-64
lines changed

mysql-test/r/stat_tables.result

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,25 @@ id select_type table type possible_keys key key_len ref rows Extra
591591
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
592592
set use_stat_tables=@save_use_stat_tables;
593593
#
594+
# MDEV-17734: AddressSanitizer: use-after-poison in create_key_parts_for_pseudo_indexes
595+
#
596+
set @@use_stat_tables= PREFERABLY;
597+
set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
598+
set @@optimizer_use_condition_selectivity=4;
599+
set @save_use_stat_tables= @@use_stat_tables;
600+
create table t1 (a int, b int);
601+
insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10);
602+
analyze table t1 persistent for columns (a) indexes ();
603+
Table Op Msg_type Msg_text
604+
test.t1 analyze status Engine-independent statistics collected
605+
test.t1 analyze status OK
606+
select * from t1 where a=1 and b=3;
607+
a b
608+
1 3
609+
set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
610+
set use_stat_tables=@save_use_stat_tables;
611+
drop table t1;
612+
#
594613
# MDEV-16711:CREATE OR REPLACE TABLE introducing BLOB column
595614
#
596615
SET use_stat_tables= PREFERABLY;

mysql-test/r/stat_tables_innodb.result

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,25 @@ id select_type table type possible_keys key key_len ref rows Extra
618618
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
619619
set use_stat_tables=@save_use_stat_tables;
620620
#
621+
# MDEV-17734: AddressSanitizer: use-after-poison in create_key_parts_for_pseudo_indexes
622+
#
623+
set @@use_stat_tables= PREFERABLY;
624+
set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
625+
set @@optimizer_use_condition_selectivity=4;
626+
set @save_use_stat_tables= @@use_stat_tables;
627+
create table t1 (a int, b int);
628+
insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10);
629+
analyze table t1 persistent for columns (a) indexes ();
630+
Table Op Msg_type Msg_text
631+
test.t1 analyze status Engine-independent statistics collected
632+
test.t1 analyze status OK
633+
select * from t1 where a=1 and b=3;
634+
a b
635+
1 3
636+
set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
637+
set use_stat_tables=@save_use_stat_tables;
638+
drop table t1;
639+
#
621640
# MDEV-16711:CREATE OR REPLACE TABLE introducing BLOB column
622641
#
623642
SET use_stat_tables= PREFERABLY;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use mysql;
2+
insert db (db,user,select_priv) values ('foo','dwr_foo','Y'), ('bar','dwr_bar','Y');
3+
insert roles_mapping (user,role) values ('dwr_qux_dev','dwr_foo'),('dwr_qux_dev','dwr_bar');
4+
insert user (user,show_db_priv,is_role) values ('dwr_foo','N','Y'), ('dwr_bar','N','Y'), ('dwr_qux_dev','Y','Y');
5+
Warnings:
6+
Warning 1364 Field 'ssl_cipher' doesn't have a default value
7+
Warning 1364 Field 'x509_issuer' doesn't have a default value
8+
Warning 1364 Field 'x509_subject' doesn't have a default value
9+
Warning 1364 Field 'authentication_string' doesn't have a default value
10+
flush privileges;
11+
drop role dwr_foo;
12+
drop role dwr_bar;
13+
drop role dwr_qux_dev;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#
2+
# MDEV-17898 FLUSH PRIVILEGES crashes server with segfault
3+
#
4+
use mysql;
5+
insert db (db,user,select_priv) values ('foo','dwr_foo','Y'), ('bar','dwr_bar','Y');
6+
insert roles_mapping (user,role) values ('dwr_qux_dev','dwr_foo'),('dwr_qux_dev','dwr_bar');
7+
insert user (user,show_db_priv,is_role) values ('dwr_foo','N','Y'), ('dwr_bar','N','Y'), ('dwr_qux_dev','Y','Y');
8+
flush privileges;
9+
drop role dwr_foo;
10+
drop role dwr_bar;
11+
drop role dwr_qux_dev;

mysql-test/t/stat_tables.test

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,23 @@ SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user;
369369
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
370370
set use_stat_tables=@save_use_stat_tables;
371371

372+
--echo #
373+
--echo # MDEV-17734: AddressSanitizer: use-after-poison in create_key_parts_for_pseudo_indexes
374+
--echo #
375+
376+
set @@use_stat_tables= PREFERABLY;
377+
set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
378+
set @@optimizer_use_condition_selectivity=4;
379+
set @save_use_stat_tables= @@use_stat_tables;
380+
create table t1 (a int, b int);
381+
insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10);
382+
383+
analyze table t1 persistent for columns (a) indexes ();
384+
select * from t1 where a=1 and b=3;
385+
set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
386+
set use_stat_tables=@save_use_stat_tables;
387+
drop table t1;
388+
372389
--echo #
373390
--echo # MDEV-16711:CREATE OR REPLACE TABLE introducing BLOB column
374391
--echo #

sql/opt_range.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2762,7 +2762,9 @@ bool create_key_parts_for_pseudo_indexes(RANGE_OPT_PARAM *param,
27622762
if (bitmap_is_set(used_fields, (*field_ptr)->field_index))
27632763
{
27642764
Field *field= *field_ptr;
2765-
if (field->type() == MYSQL_TYPE_GEOMETRY)
2765+
Column_statistics* col_stats= field->read_stats;
2766+
if (field->type() == MYSQL_TYPE_GEOMETRY ||
2767+
!col_stats || col_stats->no_stat_values_provided())
27662768
continue;
27672769

27682770
uint16 store_length;

0 commit comments

Comments
 (0)