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

storage: avoid crash in splitPostApply #39658

Merged
merged 1 commit into from
Aug 14, 2019
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
11 changes: 11 additions & 0 deletions pkg/storage/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -2156,6 +2156,17 @@ func splitPostApply(
// about restoring the existing minReplicaID if it's nonzero. No
// promises have been made, so none need to be kept.
rightRng.mu.minReplicaID = 0
rightDesc, ok := split.RightDesc.GetReplicaDescriptor(r.StoreID())
if !ok {
log.Fatalf(ctx, "replica descriptor of local store not found in right hand side of split")
}
// We also have to potentially wind back the replicaID to avoid an error
// below. We can't overwrite unconditionally since usually the replicaID is
// zero (and thus special) and in that case, moving it forward out-of-band
// results in an broken state.
if rightRng.mu.replicaID > rightDesc.ReplicaID {
rightRng.mu.replicaID = rightDesc.ReplicaID
}
err := rightRng.initRaftMuLockedReplicaMuLocked(&split.RightDesc, r.store.Clock(), 0)
rightRng.mu.Unlock()
if err != nil {
Expand Down