Skip to content

Commit

Permalink
change split key range right key to use ts=0
Browse files Browse the repository at this point in the history
  • Loading branch information
hugy718 committed Apr 27, 2023
1 parent 1bbd08d commit f9e789f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions levels.go
Original file line number Diff line number Diff line change
Expand Up @@ -1073,14 +1073,13 @@ func (s *levelsController) addSplits(cd *compactDef) {
return
}
if i%width == width-1 {
// Right should always have ts=maxUint64 otherwise we'll lose keys
// Right is assigned ts=0. The encoding ts bytes takes maxuin64-ts.
// So, for the same key, smaller TS will be considered larger
// in subcompaction. Consider the following.
// Top table is [A1...C3(deleted)]
// bot table is [B1....C2]
// This will generate splits like [A1 ... C2] . Notice that we
// dropped the C3 which is the last key of the top table.
// See TestCompaction/with_split test.
right := y.KeyWithTs(y.ParseKey(t.Biggest()), math.MaxUint64)
// This will generate splits like [A1 ... C0], including any records of Key C.
right := y.KeyWithTs(y.ParseKey(t.Biggest()), 0)
addRange(right)
}
}
Expand Down

0 comments on commit f9e789f

Please sign in to comment.