-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Truncate range tombstones by leveraging InternalKeys #4432
Closed
abhimadan
wants to merge
6
commits into
facebook:master
from
abhimadan:range-del-agg-trunc-fix-intkey
Closed
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f502dd6
Truncate RangeTombstones by leveraging InternalKeys
abhimadan 7923a12
Improve a comment, fix clang compile error
abhimadan ce5d472
Address PR comments, actually use compaction boundaries
abhimadan 7820f5e
Include tombstones that start at next SST's smallest key
abhimadan 45aa08e
Fix linter errors
abhimadan e8d49e0
Remove default initialization (disallows initializer list)
abhimadan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abhimadan @ajkr This change broke one of the tests in CockroachDB. The test sets up a scenario where there are 4 sstables:
The L0 sstable has a single key at
a000000000
and a range deletion from[c000000000,c000010000)
. The test then performs a manual compaction from[c000000000,c000010000)
(i.e. the same keys as the range deletion). The first step in the manual compaction compacts the L0 sstable to L5 which results in two sstables at L5:This is where the problem occurs for the test. Prior to this line of code changing, the compaction generated L5 sstables that looked like:
It looks like the range tombstone is being included in sstable
#12
unnecessarily. I see that this change was made in order to fix the problem tested byKeyAtOverlappingEndpointReappears
, though it looks to be pessimistic. In my test,upper_bound
is being set to the min-key in the following table.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@petermattis - thanks for pointing this out. Just to confirm, the problem here is performance (we store an extra range tombstone and unnecessarily extend an SST file), not correctness, right?
Understood what you meant about comparing against next file's start key being pessimistic. Let's see if there's a way to compare against the current file's end key instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, then we'd need additional logic to handle tombstones fully in the gap between files. Will think a bit more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the problem is performance, not correctness. In my test, when
#12
is compacted from L5 to L6, it will compact against 2 sstables in L6 instead of 1. I think we can generate scenarios which produce arbitrarily large compactions due to this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, we can probably revert this change, and fix
KeyAtOverlappingEndpointReappears
by having an additional condition that tombstones we skip should start strictly after the file's last point key.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proposed fix: #4592. BTW, if your test exercises RocksDB APIs directly, I'd be interested in copying it :P.