Skip to content

Commit 8dc6a23

Browse files
authored
[sys-4815] treat inconsistent epoch number as poison instead of corruption (#284)
The consistency check compares the replicated epoch number from leader against epoch number calculated based on existing files on followers. It's actually possible that the consistency check fails in following rare case: D as leader running on old rocksdb, E as follower running on new rocksdb. Then D is re-opened as leader on new rocksdb, during which we recover the epoch number on db open. During recovery, the epoch number calculated on D might be different from the epoch number on E. But we won't detect the inconsistency until the mismatched files are compacted, which may only happen a few hours/days later. This is fine since E will resync manifest files when re-opened. And very likely shard reopen has already happened during latest leaf roll. But out of precaution, let's treat this as poison so that E will reopen immediately instead of corruption (which will cause permanently errored shards) before enabling epoch replication for all orgs.
1 parent 472e3fc commit 8dc6a23

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

db/db_impl/db_impl.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,12 +1448,13 @@ Status DBImpl::ApplyReplicationLogRecord(ReplicationLogRecord record,
14481448
cfd->SetNextEpochNumber(newFiles.begin()->second.epoch_number);
14491449
}
14501450

1451-
// do consistency check by comparing the replicated epoch number against
1452-
// inferred epoch number
1451+
// do consistency check by comparing the replicated epoch number
1452+
// against inferred epoch number No need to
1453+
// `reset_next_epoch_number` here since we have already done it
14531454
s = InferEpochNumber(&e, cfd, info,
14541455
false /* reset_next_epoch_number */);
14551456
if (s.ok() && info->mismatched_epoch_num > 0) {
1456-
s = Status::Corruption("epoch number consistency check fails");
1457+
s = Status::Poison("epoch number consistency check fails");
14571458
}
14581459
if (!s.ok()) {
14591460
break;

0 commit comments

Comments
 (0)