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

MDEV-6442: Assertion `join->best_read < double(...)' failed with optimizer_use_condition_selectivity >=3

- Fix the crash by making get_column_range_cardinality() 
  to handle the special case where Column_stats objects 
  is an all-zeros object (the question of what is the point
  of having Field::read_stats point to such object remains a 
  mystery)

- Added a few comments. Learning the code still.
This commit is contained in:
Sergey Petrunya
2014-10-06 15:29:22 +04:00
parent 689ffe3559
commit fd4c9af398
4 changed files with 70 additions and 3 deletions

View File

@ -1358,6 +1358,8 @@ set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivit
DROP TABLE t1,t2;
set use_stat_tables=@save_use_stat_tables;
set optimizer_switch=@save_optimizer_switch_for_selectivity_test;
set @tmp_ust= @@use_stat_tables;
set @tmp_oucs= @@optimizer_use_condition_selectivity;
#
# MDEV-6808: MariaDB 10.0.13 crash with optimizer_use_condition_selectivity > 1
#
@ -1393,4 +1395,22 @@ t2.subject_type in ('user')
repost_id subject_type subject_id object_type object_id is_private event_id
DROP TABLE t1, t2;
set optimizer_use_condition_selectivity=@tmp_mdev6808;
#
# MDEV-6442: Assertion `join->best_read < double(...)' failed with optimizer_use_condition_selectivity >=3, ...
#
SET use_stat_tables = PREFERABLY;
SET optimizer_use_condition_selectivity = 3;
CREATE TABLE t1 ( a VARCHAR(3), b VARCHAR(8), KEY (a,b) ) ENGINE=InnoDB;
INSERT INTO t1 VALUES ('USA','Chinese'),('USA','English');
CREATE TABLE t2 (i INT) ENGINE=InnoDB;
SELECT * FROM t1, t2 WHERE ( 't', 'o' ) IN (
SELECT t1_2.b, t1_1.a FROM t1 AS t1_1 STRAIGHT_JOIN t1 AS t1_2 ON ( t1_2.a = t1_1.b )
);
a b i
DROP TABLE t1,t2;
#
# End of 10.0 tests
#
set use_stat_tables= @tmp_ust;
set optimizer_use_condition_selectivity= @tmp_oucs;
SET SESSION STORAGE_ENGINE=DEFAULT;