Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kvserver: explain our use of (*raftGroup).ReportSnapshot #87702

Merged
merged 1 commit into from
Sep 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkg/kv/kvserver/replica_raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -1649,6 +1649,15 @@ func (r *Replica) reportSnapshotStatus(ctx context.Context, to roachpb.ReplicaID
snapStatus = raft.SnapshotFailure
}

// NB: we are technically violating raft's contract around which index the
// snapshot is supposed to be at. Raft asked for a particular applied index,
// but the snapshot we sent might have been at a higher (most of the time) or
// lower (corner cases) index too. Luckily this is not an issue as the call
// below will only inform at which idnex the follower is next probed (after
tbg marked this conversation as resolved.
Show resolved Hide resolved
// ReportSnapshot with a success). Raft does not a priori assume that the
// index it requested is now actually durable on the follower.
//
// See: https://github.com/cockroachdb/cockroach/issues/87581
if err := r.withRaftGroup(true, func(raftGroup *raft.RawNode) (bool, error) {
raftGroup.ReportSnapshot(uint64(to), snapStatus)
return true, nil
Expand Down