diff --git a/config/config.go b/config/config.go index 44876af48fd..45bd1083056 100644 --- a/config/config.go +++ b/config/config.go @@ -860,6 +860,10 @@ type ConsensusConfig struct { PeerQueryMaj23SleepDuration time.Duration `mapstructure:"peer_query_maj23_sleep_duration"` DoubleSignCheckHeight int64 `mapstructure:"double_sign_check_height"` + + // If set, replay will try to recover from a corrupted WAL error by stopping + // WAL replay after encoutering a corrupted message. + DebugUnsafeReplayRecoverCorruptedWAL bool `mapstructure:"debug_unsafe_replay_recover_corrupted_wal"` } // DefaultConsensusConfig returns a default configuration for the consensus service diff --git a/consensus/replay.go b/consensus/replay.go index bfec9e96d44..c91053a8af8 100644 --- a/consensus/replay.go +++ b/consensus/replay.go @@ -149,6 +149,11 @@ LOOP: break LOOP case IsDataCorruptionError(err): cs.Logger.Error("data has been corrupted in last height of consensus WAL", "err", err, "height", csHeight) + if cs.config.DebugUnsafeReplayRecoverCorruptedWAL { + cs.Logger.Debug("skipping corrupted WAL") + // Ignore data corruption error. + break LOOP + } return err case err != nil: return err