Skip to content
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

Fix user comparator receiving internal key (#4575) #26

Merged
merged 1 commit into from
Mar 3, 2019

Conversation

ajkr
Copy link

@ajkr ajkr commented Feb 28, 2019

Summary:
There was a bug that the user comparator would receive the internal key instead of the user key. The bug was due to RangeMightExistAfterSortedRun expecting user key but receiving internal key when called in GenerateBottommostFiles. The patch augment an existing unit test to reproduce the bug and fixes it.
Pull Request resolved: facebook#4575

Differential Revision: D10500434

Pulled By: maysamyabandeh

fbshipit-source-id: 858346d2fd102cce9e20516d77338c112bdfe366


This change is Reviewable

Summary:
There was a bug that the user comparator would receive the internal key instead of the user key. The bug was due to RangeMightExistAfterSortedRun expecting user key but receiving internal key when called in GenerateBottommostFiles. The patch augment an existing unit test to reproduce the bug and fixes it.
Pull Request resolved: facebook#4575

Differential Revision: D10500434

Pulled By: maysamyabandeh

fbshipit-source-id: 858346d2fd102cce9e20516d77338c112bdfe366
Copy link

@petermattis petermattis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the effect of this bug? Seems like it could cause a comparator to crash if it expected a key to match a particular format. It also might incorrectly populate bottommost_files_, but I'm not familiar with what that variable is used for.

@ajkr
Copy link
Author

ajkr commented Mar 3, 2019

The incorrect population of bottommost_files_ is potentially problematic. The compaction picker uses it when deciding which files to mark for compaction. In particular we want to recompact a bottommost SST when it has key versions that can be eliminated, maybe because they were written to that file for a snapshot that no longer exists. This feature prevents old key versions from getting stuck in the bottom level forever, which caused high space-amp.

I have some unproven fear that an infinite loop is possible if bottommost_files_ is wrong and we put non-bottommost files through this type of compaction. For a non-bottommost file, we're not guaranteed to drop unnecessary key versions (e.g., tombstones covering nothing may be preserved), so the output file may look the same as the input file. Then the conditions for triggering compaction on that new file would be met, so it'd continue forever.

@ajkr ajkr merged commit 47e4f25 into crl-release-5.17.2 Mar 3, 2019
@ajkr ajkr deleted the backport-fix-user-comparator-on-ikey branch March 3, 2019 14:38
ajkr added a commit to ajkr/cockroach that referenced this pull request Mar 7, 2019
craig bot pushed a commit to cockroachdb/cockroach that referenced this pull request Mar 7, 2019
35511: workload: use workload split functionality with tpcc r=ajwerner a=ajwerner

Before this PR the tpcc workloads dealt with splitting ranges on their own.
This splitting logic lacked the sophistication built in to the workload package
split implementation which works to mitigate imbalance.

Fixes #25872.

Release note: None

35512: c-deps: bump rocksdb for bottommost files bug fix r=ajkr a=ajkr

Pick up cockroachdb/rocksdb#26

Release note: None

35519: sql: fix a non-deterministic test r=knz a=knz

Release note: None

35520: build: Fix docker link for alpha/beta builds r=knz a=bdarnell

Release note: None

Co-authored-by: Andrew Werner <ajwerner@cockroachlabs.com>
Co-authored-by: Andrew Kryczka <andrew.kryczka2@gmail.com>
Co-authored-by: Raphael 'kena' Poss <knz@cockroachlabs.com>
Co-authored-by: Ben Darnell <ben@bendarnell.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants