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

MDEV-32667 dict_stats_save_index_stat() reads uninitialized index->stats_error_printed

Problem:
========
- dict_stats_table_clone_create() does not initialize the
flag stats_error_printed in either dict_table_t or dict_index_t.
Because dict_stats_save_index_stat() is operating on a copy
of a dict_index_t object, it appears that
dict_index_t::stats_error_printed will always be false
for actual metadata objects, and uninitialized in
dict_stats_save_index_stat().

Solution:
=========
dict_stats_table_clone_create(): Assign stats_error_printed
for table and index while copying the statistics
This commit is contained in:
Thirunarayanan Balathandayuthapani
2024-11-08 11:35:19 +05:30
parent 4b38af06a4
commit 98d57719e2
3 changed files with 32 additions and 0 deletions

View File

@ -13,3 +13,19 @@ a
drop table t1;
rename table mysql.table_stats_save to mysql.table_stats;
flush tables;
#
# MDEV-32667 dict_stats_save_index_stat() reads uninitialized
# index->stats_error_printed
#
call mtr.add_suppression("InnoDB: Cannot save index statistics for table");
CREATE TABLE t1(a INT) ENGINE=InnoDB STATS_PERSISTENT=1 STATS_AUTO_RECALC=1;
BEGIN;
SELECT COUNT(*)>=0 FROM mysql.innodb_index_stats LOCK IN SHARE MODE;
COUNT(*)>=0
1
INSERT INTO t1 VALUES(0),(0);
SELECT sleep(1);
sleep(1)
0
COMMIT;
DROP TABLE t1;