Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
35130: storage: use lease start time to determine follower read safety r=ajwerner a=ajwerner

This change obviously needs some testing. I'm putting it out to make sure I
understand the issue and proposed solution.

This change attempts to address a situation where a lease transfer may prevent
a follower read. This happens because after the lease transfer we no longer have
any information in the closedts storage regarding the range from the new
leaseholder.

Fixes cockroachdb#35129.
Fixes cockroachdb#32980.

Release note: None

Co-authored-by: Andrew Werner <[email protected]>
  • Loading branch information
craig[bot] and ajwerner committed Mar 14, 2019
2 parents eb5adcb + 4c0cbf8 commit d8d92b7
Show file tree
Hide file tree
Showing 11 changed files with 469 additions and 183 deletions.
18 changes: 18 additions & 0 deletions pkg/server/testserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,24 @@ func (ts *TestServer) LookupRange(key roachpb.Key) (roachpb.RangeDescriptor, err
return rs[0], nil
}

// MergeRanges merges the range containing leftKey with the range to its right.
func (ts *TestServer) MergeRanges(leftKey roachpb.Key) (roachpb.RangeDescriptor, error) {

ctx := context.Background()
mergeReq := roachpb.AdminMergeRequest{
RequestHeader: roachpb.RequestHeader{
Key: leftKey,
},
}
_, pErr := client.SendWrapped(ctx, ts.DB().NonTransactionalSender(), &mergeReq)
if pErr != nil {
return roachpb.RangeDescriptor{},
errors.Errorf(
"%q: merge unexpected error: %s", leftKey, pErr)
}
return ts.LookupRange(leftKey)
}

// SplitRange splits the range containing splitKey.
// The right range created by the split starts at the split key and extends to the
// original range's end key.
Expand Down
Loading

0 comments on commit d8d92b7

Please sign in to comment.