Skip to content

Commit 33a462e

Browse files
committed
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 6e6a1b3 (MDEV-35000)
1 parent b0ec993 commit 33a462e

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,13 @@ DROP TABLE t1;
101101
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1;
102102
DROP TABLE t1;
103103
# End of 10.6 tests
104+
#
105+
# MDEV-36373 Warning: ... persistent statistics storage is corrupted
106+
#
107+
CREATE TABLE t1 (c INT) ENGINE=InnoDB;
108+
SET STATEMENT tx_read_only=1 FOR ANALYZE TABLE t1;
109+
Table Op Msg_type Msg_text
110+
test.t1 analyze status Engine-independent statistics collected
111+
test.t1 analyze status OK
112+
DROP TABLE t1;
113+
# End of 10.11 tests

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,12 @@ CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1;
110110
DROP TABLE t1;
111111

112112
--echo # End of 10.6 tests
113+
114+
--echo #
115+
--echo # MDEV-36373 Warning: ... persistent statistics storage is corrupted
116+
--echo #
117+
CREATE TABLE t1 (c INT) ENGINE=InnoDB;
118+
SET STATEMENT tx_read_only=1 FOR ANALYZE TABLE t1;
119+
DROP TABLE t1;
120+
121+
--echo # End of 10.11 tests

storage/innobase/handler/ha_innodb.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5872,7 +5872,7 @@ dberr_t ha_innobase::statistics_init(dict_table_t *table, bool recalc)
58725872
if (err == DB_STATS_DO_NOT_EXIST && table->stats_is_auto_recalc())
58735873
goto recalc;
58745874
}
5875-
if (err == DB_SUCCESS)
5875+
if (err == DB_SUCCESS || err == DB_READ_ONLY)
58765876
return err;
58775877
if (!recalc)
58785878
break;
@@ -14934,6 +14934,7 @@ ha_innobase::info_low(
1493414934
ret = statistics_init(ib_table, is_analyze);
1493514935
switch (ret) {
1493614936
case DB_SUCCESS:
14937+
case DB_READ_ONLY:
1493714938
break;
1493814939
default:
1493914940
goto error;

0 commit comments

Comments
 (0)