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

Commits on Aug 14, 2019

  1. storage: avoid crash in splitPostApply

    See cockroachdb#39571.
    
    The above PR was incomplete because we also need to wind back the
    replicaID. I was able to confirm that this *actually* works by running
    tests with this diff, which simulates an incoming raft message
    reflecting a high replicaID just before the split gets applied.
    
    ```diff
    diff --git a/pkg/storage/replica_raft.go b/pkg/storage/replica_raft.go
    index 6d5a044657..981f3e1714 100644
    --- a/pkg/storage/replica_raft.go
    +++ b/pkg/storage/replica_raft.go
    @@ -1525,7 +1525,7 @@ func (r *Replica) maybeAcquireSplitMergeLock(
     func (r *Replica) acquireSplitLock(
     	ctx context.Context, split *roachpb.SplitTrigger,
     ) (func(), error) {
    -	rightRng, _, err := r.store.getOrCreateReplica(ctx, split.RightDesc.RangeID, 0, nil)
    +	rightRng, _, err := r.store.getOrCreateReplica(ctx, split.RightDesc.RangeID, 100, nil)
     	if err != nil {
     		return nil, err
     	}
    ```
    
    @danhhz is working on a real test for this, so we'll soon have
    end-to-end coverage.
    
    Fixes cockroachdb#39651.
    
    Release note: None
    tbg committed Aug 14, 2019
    Configuration menu
    Copy the full SHA
    d822868 View commit details
    Browse the repository at this point in the history