MB-72725: Improve efficiency of index compaction#2373
Merged
Conversation
Likith101
reviewed
Jul 6, 2026
capemox
approved these changes
Jul 7, 2026
Likith101
approved these changes
Jul 7, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves Scorch index compaction planning/execution by making merge decisions account for logical deletions (via “live” sizing), avoiding degenerate single-segment plans that don’t reclaim deletes, and introducing merged segments in a single introducer push to reduce contention and improve concurrency.
Changes:
- Add “live file size” estimation and use it in merge planning (budgeting + vector eligibility) so heavily-deleted segments can become eligible for compaction.
- Adjust merge planning/roster selection to avoid non-converging “solo fully-live” merge tasks and to ensure only meaningful merge tasks count against the budget.
- Overhaul/add unit tests (Scorch + merge planner) to assert convergence and expected final segment layouts; update docs/examples for config keys.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| index/scorch/snapshot_segment.go | Adds LiveFileSize() estimation to SegmentSnapshot. |
| index/scorch/scorch_test.go | Expands persister/merge tests and adds a deletion-vs-merge-introduction regression test. |
| index/scorch/scorch_knn_test.go | Updates KNN persistence test to use refcounted snapshot + configured persister options. |
| index/scorch/rollback_test.go | Fixes test name typo (Rollback). |
| index/scorch/mergeplan/merge_plan.go | Updates planner to use “live” sizing, adds roster selection tweaks, and introduces budget currency handling. |
| index/scorch/mergeplan/merge_plan_test.go | Refactors tests to run multi-cycle convergence assertions and adds new planner coverage. |
| index/scorch/merge.go | Changes merge execution to introduce all merged segments in one shot; updates bookkeeping and history mapping. |
| index/scorch/introducer.go | Updates merge introduction logic to use the new batch-index field when applying deletes. |
| docs/persister.md | Updates configuration examples to match expected JSON key casing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Thejas-bhat
reviewed
Jul 7, 2026
Thejas-bhat
approved these changes
Jul 8, 2026
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.
Uh oh!
There was an error while loading. Please reload this page.