Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
87408: storage: gc range tombstone - fix mvcc stat update on merge r=aliher1911 a=aliher1911

Previously if range tombstone fragment was not eligible for GC
it was not checked if it can merge with previous range tombstone
fragments stack. This was causing MVCC stats discrepancy.
This commit adds a check merge eligibility check for skipped
fragments.

Release justification: bugfix for upcoming functionality
Release note: None

Fixes: cockroachdb#87406

Co-authored-by: Oleg Afanasyev <[email protected]>
  • Loading branch information
craig[bot] and aliher1911 committed Sep 6, 2022
2 parents b4a4d1b + 7286a99 commit af1a53a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/storage/mvcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -5132,6 +5132,11 @@ func MVCCGarbageCollectRangeKeys(

// If there's nothing to GC, keep moving.
if !rangeKeys.Oldest().LessEq(gcKey.Timestamp) {
// Even if we don't GC anything for this range fragment, we might have
// changed previous and it might become mergable as a result.
if ms != nil && lhs.CanMergeRight(rangeKeys) {
ms.Add(updateStatsOnRangeKeyMerge(rangeKeys.Bounds.Key, rangeKeys.Versions))
}
rangeKeys.CloneInto(&lhs)
continue
}
Expand Down

0 comments on commit af1a53a

Please sign in to comment.