Skip to content

Commit

Permalink
MDEV-9121: innodb_force_recovery = 6 cannot recover ANY DATA when
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Jan Lindström committed Apr 27, 2016
1 parent 47e0717 commit 071ae30
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
20 changes: 15 additions & 5 deletions storage/innobase/dict/dict0boot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,22 @@ dict_boot(void)
if (err == DB_SUCCESS) {
if (srv_read_only_mode && !ibuf_is_empty()) {

ib_logf(IB_LOG_LEVEL_ERROR,
"Change buffer must be empty when --innodb-read-only "
"is set!");
if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {
ib_logf(IB_LOG_LEVEL_ERROR,
"Change buffer must be empty when --innodb-read-only "
"is set! "
"You can try to recover the database with innodb_force_recovery=5");

err = DB_ERROR;
} else {
ib_logf(IB_LOG_LEVEL_WARN,
"Change buffer not empty when --innodb-read-only "
"is set! but srv_force_recovery = %d, ignoring.",
srv_force_recovery);
}
}

err = DB_ERROR;
} else {
if (err == DB_SUCCESS) {
/* Load definitions of other indexes on system tables */

dict_load_sys_table(dict_sys->sys_tables);
Expand Down
20 changes: 15 additions & 5 deletions storage/xtradb/dict/dict0boot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -464,12 +464,22 @@ dict_boot(void)
if (err == DB_SUCCESS) {
if (srv_read_only_mode && !ibuf_is_empty()) {

ib_logf(IB_LOG_LEVEL_ERROR,
"Change buffer must be empty when --innodb-read-only "
"is set!");
if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {
ib_logf(IB_LOG_LEVEL_ERROR,
"Change buffer must be empty when --innodb-read-only "
"is set!"
"You can try to recover the database with innodb_force_recovery=5");

err = DB_ERROR;
} else {
ib_logf(IB_LOG_LEVEL_WARN,
"Change buffer not empty when --innodb-read-only "
"is set! but srv_force_recovery = %d, ignoring.",
srv_force_recovery);
}
}

err = DB_ERROR;
} else {
if (err == DB_SUCCESS) {
/* Load definitions of other indexes on system tables */

dict_load_sys_table(dict_sys->sys_tables);
Expand Down

0 comments on commit 071ae30

Please sign in to comment.