Skip to content

fix: fix an issue where the compactor causes previously deleted data to reappear#2278

Open
yangchun0821 wants to merge 4 commits into
dgraph-io:mainfrom
yangchun0821:fix-compactor-causing-deleted-data-to-reappear
Open

fix: fix an issue where the compactor causes previously deleted data to reappear#2278
yangchun0821 wants to merge 4 commits into
dgraph-io:mainfrom
yangchun0821:fix-compactor-causing-deleted-data-to-reappear

Conversation

@yangchun0821

Copy link
Copy Markdown

Description

During Level 0 compaction, the engine may skip intermediate levels and compact Level 0 tables directly to the bottommost level. This can leave stale data in the skipped intermediate levels. As a result, previously deleted keys may reappear from the user's perspective after compaction completes.

Checklist

  • Code compiles correctly and linting passes locally
  • Tests added for new functionality, or regression tests for bug fixes added as applicable

@yangchun0821 yangchun0821 requested a review from a team as a code owner May 22, 2026 04:11
@CLAassistant

CLAassistant commented May 22, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@shiva-istari shiva-istari left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @yangchun0821
Thanks for the PR and the description!

The current TestLevelTargets sub-tests only assert which baseLevel is chosen they don't verify what actually happens to the data. Could you add tests that set up the full compaction scenario and assert the
deleted key stays gone? These tests should fail on main (old code routes tombstone to wrong level, key reappears) and pass on this branch (fix routes tombstone correctly, key stays gone).

@yangchun0821

Copy link
Copy Markdown
Author

@shiva-istari
Thank you for your review. I’ve addressed your comments by adding the new test case you recommended.

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