Skip to content

Commit 071ae30

Browse files
author
Jan Lindström
committed
MDEV-9121: innodb_force_recovery = 6 cannot recover ANY DATA when
change buffer not empty Fix: Allow not empty change buffer when innodb_force_recovery >= 5 and output only a warning to error log. Note: Before using force recovery you should always take backup of your database.
1 parent 47e0717 commit 071ae30

File tree

2 files changed

+30
-10
lines changed

2 files changed

+30
-10
lines changed

storage/innobase/dict/dict0boot.cc

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -458,12 +458,22 @@ dict_boot(void)
458458
if (err == DB_SUCCESS) {
459459
if (srv_read_only_mode && !ibuf_is_empty()) {
460460

461-
ib_logf(IB_LOG_LEVEL_ERROR,
462-
"Change buffer must be empty when --innodb-read-only "
463-
"is set!");
461+
if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {
462+
ib_logf(IB_LOG_LEVEL_ERROR,
463+
"Change buffer must be empty when --innodb-read-only "
464+
"is set! "
465+
"You can try to recover the database with innodb_force_recovery=5");
466+
467+
err = DB_ERROR;
468+
} else {
469+
ib_logf(IB_LOG_LEVEL_WARN,
470+
"Change buffer not empty when --innodb-read-only "
471+
"is set! but srv_force_recovery = %d, ignoring.",
472+
srv_force_recovery);
473+
}
474+
}
464475

465-
err = DB_ERROR;
466-
} else {
476+
if (err == DB_SUCCESS) {
467477
/* Load definitions of other indexes on system tables */
468478

469479
dict_load_sys_table(dict_sys->sys_tables);

storage/xtradb/dict/dict0boot.cc

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -464,12 +464,22 @@ dict_boot(void)
464464
if (err == DB_SUCCESS) {
465465
if (srv_read_only_mode && !ibuf_is_empty()) {
466466

467-
ib_logf(IB_LOG_LEVEL_ERROR,
468-
"Change buffer must be empty when --innodb-read-only "
469-
"is set!");
467+
if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {
468+
ib_logf(IB_LOG_LEVEL_ERROR,
469+
"Change buffer must be empty when --innodb-read-only "
470+
"is set!"
471+
"You can try to recover the database with innodb_force_recovery=5");
472+
473+
err = DB_ERROR;
474+
} else {
475+
ib_logf(IB_LOG_LEVEL_WARN,
476+
"Change buffer not empty when --innodb-read-only "
477+
"is set! but srv_force_recovery = %d, ignoring.",
478+
srv_force_recovery);
479+
}
480+
}
470481

471-
err = DB_ERROR;
472-
} else {
482+
if (err == DB_SUCCESS) {
473483
/* Load definitions of other indexes on system tables */
474484

475485
dict_load_sys_table(dict_sys->sys_tables);

0 commit comments

Comments
 (0)