diff --git a/db/db_impl/db_impl.cc b/db/db_impl/db_impl.cc index 3bb2b590c60..e8c45fd737e 100644 --- a/db/db_impl/db_impl.cc +++ b/db/db_impl/db_impl.cc @@ -1539,8 +1539,12 @@ Status DBImpl::ApplyReplicationLogRecord(ReplicationLogRecord record, auto epoch_number = p.second.epoch_number; // advance next epoch number. next_epoch_number never goes // backwards - if (epoch_number != kUnknownEpochNumber && - (epoch_number >= next_epoch_number)) { + if (epoch_number == kUnknownEpochNumber) { + epoch_recovery_succeeded = false; + err_oss << "Unknown epoch number during replication"; + break; + } + if (epoch_number >= next_epoch_number) { next_epoch_number = epoch_number + 1; } }