Fix merge commit point bug: persist merge results to segments_N#12
Open
model-collapse wants to merge 1 commit intomainfrom
Open
Fix merge commit point bug: persist merge results to segments_N#12model-collapse wants to merge 1 commit intomainfrom
model-collapse wants to merge 1 commit intomainfrom
Conversation
Background merges update in-memory segmentInfos_ but the on-disk segments_N was never re-written after merges complete, causing 2x data duplication on reader reopen (19.7M docs visible instead of 10M). Changes: - Commit(): add waitForMerges + commitMergeResults after initial commit to persist merge results before triggering cascading merges - Refresh(): add waitForMerges + commitMergeResults before reopening reader so it sees the post-merge segment state - Update diagon submodule to a379571 which adds commitMergeResults(), triggerMerge(), and C API functions (diagon_commit_merge_results, diagon_wait_for_merges, diagon_maybe_merge) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
segmentInfos_but the on-disksegments_Nwas never re-written, so on reader reopen (or node restart) both source and merged segments are loaded — 19.7M docs visible instead of 10MCommit(): addwaitForMerges+commitMergeResultsafter initial commit to persist merge results before triggering cascading mergesRefresh(): addwaitForMerges+commitMergeResultsbefore reopening reader so it sees the post-merge segment statecommitMergeResults(),triggerMerge(), and C API functionsUpstream diagon changes (a379571)
IndexWriter::commitMergeResults()— writessegments_N+ cleans up source segment files without flushing or re-triggering mergesIndexWriter::triggerMerge()— public wrapper formaybeMerge(SEGMENT_FLUSH)diagon_commit_merge_results,diagon_wait_for_merges,diagon_maybe_mergeTest plan
BUILD_MODE=release make all_countequals indexed count exactly_countstill equals indexed count (no duplication)🤖 Generated with Claude Code