You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is basically the same problem encountered in #5929
If an entire fragment is deleted then, after an FTS update, the rows in that deleted fragment will still be indexed but shouldn't be. This fix uses the old_data_filter to properly prune the old data during the update.
This PR was created with the help of Claude Opus 4.6. I take responsibility for all code.
Clean and well-structured fix. The approach of threading old_data_filter through the inverted index merge pipeline is the right one, consistent with how other scalar indices handle this.
One minor observation
build_empty_batch hardcodes schema assumptions (index.rs:~1963-1987): The new build_empty_batchmanually constructs columns to match the posting list schema, duplicating the column layout knowledge that lives ininverted_list_schema()/build_batch(). If the schema ever changes (e.g., a new column is added), this function would silently produce a mismatched batch. Consider whether you could instead reuse build_batchwith an empty compressed array, or at least add a debug assertion that the constructed batch schema matchesinverted_list_schema(self.has_positions())`.
Looks good
The is_old tagging on PartitionSource is clean and correctly distinguishes old vs new partitions.
The old_doc_id_map approach in the merger correctly filters docs and remaps posting list entries in a single pass.
The single-partition shortcut bypass (len() <= 1 && old_data_filter.is_none()) is correct — can't just copy files when filtering is needed.
Filtering out empty postings before creating PostingIterator is a good defensive measure.
The regression test is thorough: covers merge_insert → compact → optimize → search, and validates both stale data removal and new data correctness.
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
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.
This is basically the same problem encountered in #5929
If an entire fragment is deleted then, after an FTS update, the rows in that deleted fragment will still be indexed but shouldn't be. This fix uses the
old_data_filterto properly prune the old data during the update.This PR was created with the help of Claude Opus 4.6. I take responsibility for all code.