Skip to content

Commit

Permalink
Merge #41036
Browse files Browse the repository at this point in the history
41036: storage: remove span declaration for merges r=ajwerner a=irfansharif

I'm just re-sending #40261 (reverted in #40446). These changes are 
intended for 20.1 and will not be merged until after branching.

---

Prior to #28661, we used to include a snapshot of the RHS in the merge
trigger. Due to this, we declared a read only span over the RHS data
range. Now that we require ranges to be collocated during merges, we
didn't need to include the snapshot nor declare the span.

Orthogonal to this are Subsume requests that block out concurrent
commands to the RHS, with the appropriate span declarations contained
therein.

Release justification: N/A
Release note: None

Co-authored-by: irfan sharif <[email protected]>
  • Loading branch information
craig[bot] and irfansharif committed Nov 11, 2019
2 parents 7641335 + 0a24e27 commit e99b282
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
22 changes: 6 additions & 16 deletions pkg/storage/batcheval/cmd_end_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,11 @@ func declareKeysEndTransaction(
})
}
if mt := et.InternalCommitTrigger.MergeTrigger; mt != nil {
// Merges write to the left side's abort span and the right side's data
// and range-local spans. They also read from the right side's range ID
// span.
leftRangeIDPrefix := keys.MakeRangeIDReplicatedPrefix(header.RangeID)
spans.AddNonMVCC(spanset.SpanReadWrite, roachpb.Span{
Key: leftRangeIDPrefix,
EndKey: leftRangeIDPrefix.PrefixEnd(),
})
spans.AddMVCC(spanset.SpanReadWrite, roachpb.Span{
Key: mt.RightDesc.StartKey.AsRawKey(),
EndKey: mt.RightDesc.EndKey.AsRawKey(),
}, header.Timestamp)
// Merges copy over the RHS abort span to the LHS, and compute
// replicated range ID stats over the RHS in the merge trigger.
spans.AddNonMVCC(spanset.SpanReadWrite, roachpb.Span{
Key: keys.MakeRangeKeyPrefix(mt.RightDesc.StartKey),
EndKey: keys.MakeRangeKeyPrefix(mt.RightDesc.EndKey),
Key: abortspan.MinKey(mt.LeftDesc.RangeID),
EndKey: abortspan.MaxKey(mt.LeftDesc.RangeID).PrefixEnd(),
})
spans.AddNonMVCC(spanset.SpanReadOnly, roachpb.Span{
Key: keys.MakeRangeIDReplicatedPrefix(mt.RightDesc.RangeID),
Expand Down Expand Up @@ -1043,8 +1033,8 @@ func splitTriggerHelper(
}

// mergeTrigger is called on a successful commit of an AdminMerge transaction.
// It writes data from the right-hand range into the left-hand range and
// recomputes stats for the left-hand range.
// It calculates stats for the LHS by merging in RHS stats, and copies over the
// abort span entries from the RHS.
func mergeTrigger(
ctx context.Context,
rec EvalContext,
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/replica_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ func (r *Replica) executeAdminCommandWithDescriptor(
// hand side range (the subsumed range). It also updates the range
// addressing metadata. The handover of responsibility for the
// reassigned key range is carried out seamlessly through a merge
// trigger carried out as part of the commit of that transaction. A
// trigger carried out as part of the commit of that transaction. A
// merge requires that the two ranges are collocated on the same set
// of replicas.
//
Expand Down

0 comments on commit e99b282

Please sign in to comment.