(release/v1.6) levels: Compaction incorrectly drops some delete markers (#1422)#1507
Merged
NamanJain8 merged 3 commits intorelease/v1.6from Sep 9, 2020
Merged
(release/v1.6) levels: Compaction incorrectly drops some delete markers (#1422)#1507NamanJain8 merged 3 commits intorelease/v1.6from
NamanJain8 merged 3 commits intorelease/v1.6from
Conversation
fd89894 ("Compaction: Expired keys and delete markers are never purged") revealed a bug in the compaction logic that leads to delete markers being incorrectly dropped during compaction. During compaction, `*levelsController.compactBuildTables` decides to drop a delete key if there is no overlap with levels lower than the bottom layer of the compaction definition. It does that by checking only the `top` table, thinking that proving that the `top` table doesn't overlap is sufficient to prove that the `bottom` table doesn't. Unfortunately, this is not the case. Not in general, and even less in the case of `DropPrefix()` where we run a same-level compaction and `top` is empty. The faulty condition was introduced way back when in e597fb7 ("Discard key versions during compaction"). (cherry picked from commit 5b90893)
jarifibrahim
approved these changes
Sep 9, 2020
Contributor
jarifibrahim
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 2 files reviewed, all discussions resolved (waiting on @ashish-goswami, @jarifibrahim, and @manishrjain)
jarifibrahim
approved these changes
Sep 9, 2020
Contributor
jarifibrahim
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 2 files reviewed, all discussions resolved (waiting on @ashish-goswami and @manishrjain)
mYmNeo
pushed a commit
to mYmNeo/badger
that referenced
this pull request
Jan 16, 2023
) (dgraph-io#1507) fd89894 ("Compaction: Expired keys and delete markers are never purged") revealed a bug in the compaction logic that leads to delete markers being incorrectly dropped during compaction. During compaction, `*levelsController.compactBuildTables` decides to drop a delete key if there is no overlap with levels lower than the bottom layer of the compaction definition. It does that by checking only the `top` table, thinking that proving that the `top` table doesn't overlap is sufficient to prove that the `bottom` table doesn't. Unfortunately, this is not the case. Not in general, and even less in the case of `DropPrefix()` where we run a same-level compaction and `top` is empty. The faulty condition was introduced way back when in e597fb7 ("Discard key versions during compaction"). (cherry picked from commit 5b90893) Co-authored-by: Damien Tournoud <damien@platform.sh>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
fd89894 ("Compaction: Expired keys and delete markers are never
purged") revealed a bug in the compaction logic that leads to delete
markers being incorrectly dropped during compaction.
During compaction,
*levelsController.compactBuildTablesdecides todrop a delete key if there is no overlap with levels lower than the
bottom layer of the compaction definition.
It does that by checking only the
toptable, thinking that provingthat the
toptable doesn't overlap is sufficient to prove thatthe
bottomtable doesn't. Unfortunately, this is not the case.Not in general, and even less in the case of
DropPrefix()wherewe run a same-level compaction and
topis empty.The faulty condition was introduced way back when in e597fb7
("Discard key versions during compaction").
(cherry picked from commit 5b90893)
This change is