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(dropPrefix): check properly if the key is present in a table #1623

Merged
merged 3 commits into from
Dec 21, 2020

Conversation

NamanJain8
Copy link
Contributor

@NamanJain8 NamanJain8 commented Dec 21, 2020

There may be a case when the table contains [0x0000,...., 0xffff]. If we are searching for k=0x0011, we should not directly infer that k is present. It may not be present. This leads to the triggering of compaction at the time of DropPrefix which is quite expensive.

This PR fixes the issue by confirming that case by searching inside the table for the prefix.
Fix for v2.2007 in #1622


This change is Reviewable

(cherry picked from commit 6d6d8cc)

DropPrefix assumes that key passed to it contains ts in last 8 bytes

(cherry picked from commit 19216ac)

add test

(cherry picked from commit efad954)
levels_test.go Show resolved Hide resolved
levels_test.go Show resolved Hide resolved
@NamanJain8 NamanJain8 merged commit afaf022 into master Dec 21, 2020
@NamanJain8 NamanJain8 deleted the naman/fix/drop-prefix branch December 21, 2020 12:05
NamanJain8 added a commit that referenced this pull request Jan 6, 2021
There may be a case when the table contains [0x0000,...., 0xffff]. If we are searching for k=0x0011, we should not directly infer that k is present. It may not be present. This leads to the triggering of compaction at the time of DropPrefix which is quite expensive.

This PR fixes the issue by confirming that case by searching inside the table for the prefix.

(cherry picked from commit afaf022)
mYmNeo added a commit to mYmNeo/badger that referenced this pull request Jan 17, 2023
mYmNeo added a commit to mYmNeo/badger that referenced this pull request Feb 13, 2023
mYmNeo added a commit to mYmNeo/badger that referenced this pull request Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants