Repository navigation
Conversation
…ow ids A segment's postings are only valid for rows still stored in the fragments it covers, but every full-text search path masks hits with one prefilter built over the union of all segment coverages. Under stable row ids an updated row keeps its id while moving to a fragment another segment covers, so the old segment's posting for the old token passed the shared mask: after `optimize_indices(OptimizeOptions::append())`, a match query for the old token returned the updated row while a filter scan returned nothing. The opener now restricts each segment to the live row ids currently stored in the fragments it covers (`InvertedIndex::with_allowed_rows`, built from the cached stable-row-id allow-list for that coverage), and every search entry intersects that restriction into the query mask per segment: the per-segment BM25 search, the compound search, the cross-column search, and the combined-fields search. Address-based row ids and single-segment indices are unchanged.
…gment merges - Cross-column compound search: filter each source's staged candidates by the rows its segment may report, so a moved row is not matched against the old segment's postings. - combined_fields: count a row's length only from segments that may report it, so a moved row's BM25F length leaves out its old content. - Segment merges: filter each source segment by its own coverage instead of the union of all sources, in both optimize_indices and merge_existing_index_segments, so a merge does not carry a stale posting into the merged segment. Skip the posting rebuild when nothing is dropped. The regression test follows the reproduction in lance-format#9817 and covers match, phrase, cross-column, combined_fields and both merge paths. Refs lance-format#9817
|
Hi @wjones127 @BubbleCal Would u mind to take look ? This is a bug of incorrect data querying in the stable row id scenario. Thanks! |
|
@zhangyue19921010 why did you close this? |
Hi @wjones127 thanks for taking a look. To start with, I haven't been able to find a good way to address the additional cold-read cost. Also, I came across #8085 — I'm not sure whether it will naturally resolve this issue once it's ready. That said, if you could review it and we could work on solving it together, I'd really appreciate it. |
9dc5bb4 to
84ae40a
Compare
There was a problem hiding this comment.
The merge integration is fixed, and both stale-posting regression cases pass. Per-segment ownership addresses stale FTS postings in search and both merge paths.
Extra cold-query I/O and decoded-column memory remain the author-accepted non-blocking trade-off. Prewarming with sufficient cache can amortize that cost.
FTS still trains and updates with row IDs, so the broader row-address conversion in #8085 does not supersede this fix.
Please mark this PR with the breaking-change label.
Problem
On a table with stable row ids, an update keeps a row's id but moves the row to a new fragment. After an append-only
optimize_indicesgives that fragment its own FTS segment, the old segment's postings for the row become visible again:optimize_indicesormerge_existing_index_segments) carries the stale posting into the merged segment, where it can no longer be filtered out.All segments share one prefilter built over the union of their fragment coverage. The moved row's id is live in a fragment the new segment covers, so the old segment's posting passes the filter. Merging filters old rows against the same union.
This is the full-text part of #9817; the BTREE part is fixed in #9785.
Fix