Skip to content

Commit 850bf33

Browse files
committed
MDEV-20374: innodb.innodb_mysql fails sporadically in BB
Stabilize the test: - replace Rows column in EXPLAIN output for one query - Use EITS statistics for another query (in that testcase, the query must use LooseScan)
1 parent 4d53825 commit 850bf33

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

mysql-test/include/mix1.inc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,16 @@ INSERT INTO t1(id, dept, age, name) VALUES
455455
(4011, 'cs7', 10, 'rs4'), (4012, 'cs8', 20, 'rs4'), (4019, 'cs9', 10, 'rs5'),
456456
(4020, 'cs10', 20, 'rs5'),(4027, 'cs11', 10, 'rs6'),(4028, 'cs12', 20, 'rs6');
457457

458+
set
459+
@tmp_uss=@@use_stat_tables,
460+
@tmp_occ=@@optimizer_use_condition_selectivity;
461+
set
462+
use_stat_tables='preferably',
463+
optimizer_use_condition_selectivity=4;
464+
465+
analyze table t1 persistent for all;
466+
flush tables;
467+
458468
EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
459469
SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
460470
DELETE FROM t1;
@@ -464,6 +474,9 @@ EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
464474
SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
465475

466476
DROP TABLE t1;
477+
set
478+
use_stat_tables=@tmp_uss,
479+
optimizer_use_condition_selectivity=@tmp_occ;
467480

468481
--source include/innodb_rollback_on_timeout.inc
469482

mysql-test/suite/innodb/r/innodb_mysql.result

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,17 @@ INSERT INTO t1(id, dept, age, name) VALUES
383383
(3996, 'cs4', 20, 'rs2'), (4003, 'cs5', 10, 'rs3'), (4004, 'cs6', 20, 'rs3'),
384384
(4011, 'cs7', 10, 'rs4'), (4012, 'cs8', 20, 'rs4'), (4019, 'cs9', 10, 'rs5'),
385385
(4020, 'cs10', 20, 'rs5'),(4027, 'cs11', 10, 'rs6'),(4028, 'cs12', 20, 'rs6');
386+
set
387+
@tmp_uss=@@use_stat_tables,
388+
@tmp_occ=@@optimizer_use_condition_selectivity;
389+
set
390+
use_stat_tables='preferably',
391+
optimizer_use_condition_selectivity=4;
392+
analyze table t1 persistent for all;
393+
Table Op Msg_type Msg_text
394+
test.t1 analyze status Engine-independent statistics collected
395+
test.t1 analyze status OK
396+
flush tables;
386397
EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
387398
id select_type table type possible_keys key key_len ref rows Extra
388399
1 SIMPLE t1 ref name name 22 const 2 Using where; Using index
@@ -398,6 +409,9 @@ id select_type table type possible_keys key key_len ref rows Extra
398409
SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
399410
name dept
400411
DROP TABLE t1;
412+
set
413+
use_stat_tables=@tmp_uss,
414+
optimizer_use_condition_selectivity=@tmp_occ;
401415
drop table if exists t1;
402416
show variables like 'innodb_rollback_on_timeout';
403417
Variable_name Value
@@ -3166,8 +3180,8 @@ SELECT COUNT(*) FROM
31663180
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
31673181
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
31683182
id select_type table type possible_keys key key_len ref rows Extra
3169-
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 1537
3170-
2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 1537 Using sort_union(idx,PRIMARY); Using where
3183+
1 PRIMARY <derived2> ALL NULL NULL NULL NULL #
3184+
2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL # Using sort_union(idx,PRIMARY); Using where
31713185
SELECT COUNT(*) FROM
31723186
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
31733187
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;

mysql-test/suite/innodb/t/innodb_mysql.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,7 @@ set @optimizer_switch_saved=@@optimizer_switch;
850850
SET SESSION optimizer_switch='derived_merge=off';
851851
SET SESSION sort_buffer_size = 1024*36;
852852

853+
--replace_column 9 #
853854
EXPLAIN
854855
SELECT COUNT(*) FROM
855856
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)

0 commit comments

Comments
 (0)