mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
MDEV-20266 rocksdb.mariadb_port_fixes fails in BB about twice a day
The EXPLAIN of MDEV-14563 test case sporadically shows ALL instead of range: -1 SIMPLE t2 range a a 32 NULL # Using where +1 SIMPLE t2 ALL a NULL NULL NULL # Using where The two rows of t1 and t2 are still in the memtable when EXPLAIN runs. ha_rocksdb::info() takes stats.records and records_in_range() takes the range estimate from GetApproximateMemTableStats(), which counts skiplist nodes of random height. The memtable of the default column family also holds the data of the tests run before on the same server. So both estimates vary between runs, and when the range estimate is not less than stats.records, the optimizer prefers the table scan. The fix flushes the memtable and runs ANALYZE TABLE before each EXPLAIN, like index_merge_rocksdb.test does. Then the estimates come from the SST file statistics. Both statements are hidden from the result, so the result file is unchanged.
This commit is contained in:
@@ -38,6 +38,15 @@ CREATE TABLE t1(
|
||||
KEY (a)
|
||||
) ENGINE=ROCKSDB DEFAULT CHARSET=utf8;
|
||||
insert into t1 values (1,1,1),(2,2,2);
|
||||
|
||||
# MDEV-20266: memtable row estimates are random and make the plan unstable
|
||||
--disable_query_log
|
||||
set global rocksdb_force_flush_memtable_now=1;
|
||||
--disable_result_log
|
||||
analyze table t1;
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
|
||||
--replace_column 9 #
|
||||
explain select a from t1 where a <'zzz';
|
||||
|
||||
@@ -48,6 +57,14 @@ CREATE TABLE t2(
|
||||
KEY (a)
|
||||
) ENGINE=ROCKSDB DEFAULT CHARSET=utf8;
|
||||
insert into t2 values (1,1,1),(2,2,2);
|
||||
|
||||
--disable_query_log
|
||||
set global rocksdb_force_flush_memtable_now=1;
|
||||
--disable_result_log
|
||||
analyze table t2;
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
|
||||
--replace_column 9 #
|
||||
explain select a from t2 where a <'zzz';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user