|
While working on MDEV-13626, I found the following (based on the MySQL test innodb.index_length):
--source include/have_innodb.inc
|
--source include/have_innodb_16k.inc
|
--source include/have_sequence.inc
|
CREATE TABLE t1(a INT PRIMARY KEY, b varchar(1024))
|
ENGINE=InnoDB STATS_PERSISTENT=1;
|
INSERT INTO t1 SELECT seq,repeat('b',1024) FROM seq_1_to_16384;
|
|
SELECT INDEX_LENGTH from information_schema.TABLES WHERE
|
TABLE_SCHEMA = 'test' AND TABLE_NAME = 't1';
|
ALTER TABLE t1 add INDEX b (b(800));
|
SELECT INDEX_LENGTH from information_schema.TABLES WHERE
|
TABLE_SCHEMA = 'test' AND TABLE_NAME = 't1';
|
ALTER TABLE t1 add INDEX ba (b(800),a);
|
SELECT INDEX_LENGTH from information_schema.TABLES WHERE
|
TABLE_SCHEMA = 'test' AND TABLE_NAME = 't1';
|
DROP TABLE t1;
|
The test is expected to report the INFORMATION_SCHEMA.TABLES.INDEX_LENGTH as 0, 17809408, and 35618816. Because the table is created with STATS_PERSISTENT=0 (in MariaDB 10.0 to 10.5 by default due to MDEV-4750), we will be always reporting INDEX_LENGTH as 0. This is fixed by removing a condition:
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
|
index 6fe40c75555..90b344ee3ac 100644
|
--- a/storage/innobase/dict/dict0dict.cc
|
+++ b/storage/innobase/dict/dict0dict.cc
|
@@ -331,14 +331,12 @@ dict_table_close(
|
|
const bool last_handle = table->release();
|
|
- /* Force persistent stats re-read upon next open of the table
|
+ /* Force statistics re-read upon next open of the table
|
so that FLUSH TABLE can be used to forcibly fetch stats from disk
|
if they have been manually modified. We reset table->stat_initialized
|
only if table reference count is 0 because we do not want too frequent
|
stats re-reads (e.g. in other cases than FLUSH TABLE). */
|
- if (last_handle && strchr(table->name.m_name, '/') != NULL
|
- && dict_stats_is_persistent_enabled(table)) {
|
-
|
+ if (last_handle && strchr(table->name.m_name, '/')) {
|
dict_stats_deinit(table);
|
}
|
|
|