MDEV-36373 Bogus Warning: ... storage is corrupted

ha_innobase::statistics_init(), ha_innobase::info_low():
Correctly handle a DB_READ_ONLY return value from dict_stats_save().
Fixes up commit 6e6a1b316c (MDEV-35000)
This commit is contained in:
Marko Mäkelä 2025-03-25 08:48:08 +02:00
commit 33a462e0b1
3 changed files with 21 additions and 1 deletions

View file

@ -101,3 +101,13 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1;
DROP TABLE t1;
# End of 10.6 tests
#
# MDEV-36373 Warning: ... persistent statistics storage is corrupted
#
CREATE TABLE t1 (c INT) ENGINE=InnoDB;
SET STATEMENT tx_read_only=1 FOR ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
# End of 10.11 tests

View file

@ -110,3 +110,12 @@ CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1;
DROP TABLE t1;
--echo # End of 10.6 tests
--echo #
--echo # MDEV-36373 Warning: ... persistent statistics storage is corrupted
--echo #
CREATE TABLE t1 (c INT) ENGINE=InnoDB;
SET STATEMENT tx_read_only=1 FOR ANALYZE TABLE t1;
DROP TABLE t1;
--echo # End of 10.11 tests

View file

@ -5872,7 +5872,7 @@ dberr_t ha_innobase::statistics_init(dict_table_t *table, bool recalc)
if (err == DB_STATS_DO_NOT_EXIST && table->stats_is_auto_recalc())
goto recalc;
}
if (err == DB_SUCCESS)
if (err == DB_SUCCESS || err == DB_READ_ONLY)
return err;
if (!recalc)
break;
@ -14934,6 +14934,7 @@ recalc:
ret = statistics_init(ib_table, is_analyze);
switch (ret) {
case DB_SUCCESS:
case DB_READ_ONLY:
break;
default:
goto error;