Skip to content

test: add minimal compaction correctness gate#579

Merged
ethe merged 9 commits intomainfrom
feat/compaction-correctness-phase0
Feb 5, 2026
Merged

test: add minimal compaction correctness gate#579
ethe merged 9 commits intomainfrom
feat/compaction-correctness-phase0

Conversation

@belveryin
Copy link
Collaborator

Summary

  • Add RFC docs/rfcs/0012-compaction-correctness-gate.md defining Phase 0 invariants and oracle model.
  • Introduce a minimal MVCC oracle and deterministic Phase 0 scenarios: overwrite chain, delete-heavy, range scan with deletes, and cross-segment overlap.
  • Ensure deterministic compaction forcing with explicit outcome assertions; stabilize flush behavior via flush_immutables_to_l0 and disabled minor compaction in the harness.

Tests

  • cargo test compaction_correctness_
  • cargo test

@belveryin belveryin marked this pull request as ready for review February 4, 2026 14:41
@belveryin belveryin requested a review from ethe February 4, 2026 15:55
"scenario={scenario} expected target level 1"
);

assert_oracle_matches(scenario, snapshot_ts, &snapshot, &oracle, &harness.db).await?;
Copy link
Member

Choose a reason for hiding this comment

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

The new compaction correctness scenarios reuse the same TxSnapshot before and after compaction, so post-compaction reads still use the pre-compaction manifest snapshot. This won't catch bugs where compaction writes incorrect SST outputs, because the new SSTs aren't read at all.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch. I fixed it by taking a fresh snapshot after compaction (asserting the read_ts is unchanged) and re-running the oracle/range checks on that snapshot, so we now validate the compaction outputs.

@belveryin belveryin requested a review from ethe February 5, 2026 09:53
@ethe ethe merged commit 4c4384f into main Feb 5, 2026
6 checks passed
@ethe ethe deleted the feat/compaction-correctness-phase0 branch February 5, 2026 11:20
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