fix(fts): derive empty segment codec from format - #8687
Merged
Conversation
BubbleCal
force-pushed
the
yang/fix-empty-fts-segment-codec
branch
from
August 21, 2026 07:13
7a39d82 to
78d8e11
Compare
Contributor
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The empty-segment codec now follows the segment’s declared FTS format, which fixes V1 consolidation without weakening physical-codec or cross-format validation. The regression covers both segment orders and verifies the merged V1 index remains searchable.
Xuanwo
approved these changes
Aug 21, 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.
What is the bug?
A distributed FTS rebuild can legitimately produce an intermediate segment with zero partitions when its assigned fragments contain no indexable tokens.
InvertedIndex::posting_tail_codeccurrently falls back to the defaultVarintDeltacodec for such a segment, even when its declared format is V1 /Fixed32.Merging that empty V1 segment with a populated V1 segment then fails with:
This is the same-format empty-segment failure observed in ENT-2323. It is narrower than the cross-format behavior proposed in #8681.
What issues or incorrect behavior does the bug cause?
V1 distributed FTS rebuilds fail during
merge_existing_index_segmentsbefore the replacement index can be committed. Automated maintenance can retry the same deterministic failure.How does this PR fix the problem?
When an inverted index has no partitions, derive its posting-tail codec from the segment's declared FTS format instead of using the global codec default. Populated segments continue to use their physical partition metadata, and cross-format merge behavior is unchanged.
Tests
Adds a regression test that merges an empty V1 segment with a populated V1 segment in both input orders. It verifies that:
Fixed32Local compilation and tests were intentionally skipped; CI is the validation path for this PR.