Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(level): change split key range right key to use ts=0 (#1932)
## Problem This old implementation is not incorrect, but it does not seem to follow the logic in its description. When a compaction is split into subcompaction jobs, each of them builds an iterator on all tables touched by the compaction and iterates over a certain `keyRange` defined in `addSplits`. In combination, they covers the key range of all the tables in the compaction. The right key of a key range is intended to be the right key of a bottom level table (`cd,bot`), It is intended to include all different versions of that key, as described in the comments. However, using `math.MaxUint64` will exclude those keys from this `keyRange` and include them in the next split. The reason is that the timestamp is encoded as `math.MaUint64-ts` in `y.KeyWithTs`, so a key with larger ts is actually smaller in `y.CompareKeys`. It can be corrected by using ts=0. Note that even using ts=math.MaxUint64 is not going to drop keys unlike what the comments above suggest. because those keys are covered in the subsequent split and the last split have an empty right key, iterating till the end of the tables being compacted. ## Solution Changed the timestamp used for split key range right key from `math.MaxUint64` to `0`. Updated the comments above it.
- Loading branch information