Skip to content

Commit

Permalink
vsr: clarify that checking view_durable is not needed in jump_sync
Browse files Browse the repository at this point in the history
It is correct to check only view, not view_durable here. This can't lead
to a situation where we crash and restart with an older view and a newer
sync target, because superblock updates are serialized.
  • Loading branch information
matklad committed Feb 27, 2024
1 parent eced32a commit 058b7c8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/vsr/replica.zig
Original file line number Diff line number Diff line change
Expand Up @@ -8400,6 +8400,14 @@ pub fn ReplicaType(
return;
}

if (candidate.view > self.view_durable()) {
// For ignoring, it is correct to check only view and not view_durable. This can't
// lead to a situation where we crash and restart with an older view and a newer
// sync target, because superblock updates are serialized.
assert(self.view > self.view_durable());
assert(self.view_durable_updating());
}

// Don't sync backwards, or to our current checkpoint.
if (candidate.checkpoint_op <= self.op_checkpoint()) return;

Expand Down

0 comments on commit 058b7c8

Please sign in to comment.