-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compaction: use sstable writer for detecting user key changes
The `userKeyChangeSplitter` is responsible for avoiding splits within a user key during flushes. Previously, it worked by recording the current user key when a split is requested. This introduced a delay in splitting. When the split is requested, the current key might already be different than the last key written to the sstable. This change alters the `userKeyChangeSplitter` to read the last written point key from the current sstable writer and the last written range key from the range deletion fragmenter. This has a couple advantages: a) It avoids an extra copy of a user key. b) It may split sooner, closer to the target file size. This is a practical concern in writing unit tests that involves flushes and small target file sizes. If we prevent splitting user keys across outputs in compactions too, it will become a practical concern there too. c) It exposes the previous point key to the broader compaction loop, which is necessary for narrowing the conditions during which the compaction loop must flush all/additional range tombstones. Currently, we ignore the splitters' suggested split point during flushes because we may have already output a key with the user key to the current sstable. Future commits will be able to read this previous point key and use the splitters' suggestion if the previous point key's user key is not equal to the splitters' suggestion.
- Loading branch information
Showing
5 changed files
with
71 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters