Repository navigation
feat(index): support distributed optimize for MinHash LSH - #10884
zhangyue19921010 merged 1 commit into
Conversation
|
Could @zhangyue19921010 help review this when you have chance. |
40f607c to
3bae158
Compare
| || segment_has_btree_details(segment) | ||
| || segment_has_bitmap_details(segment) | ||
| || segment_has_ngram_details(segment) | ||
| || segment_has_minhashlsh_details(segment) |
There was a problem hiding this comment.
With stable row IDs on a shallow clone, bounded optimize retains the old segment while indexing the updated row, allowing its stale signature to pass the shared row-ID mask and match the old text again. Please fall back to unsplit optimization or filter the stale entry before publishing the new segment.
There was a problem hiding this comment.
Thanks for catching this. This is fixed after rebasing onto #9858, which switched MinHash LSH segments from _rowid to _rowaddr. Even when a shallow clone retains the original segment, search now drops the deleted row address before resolving it to a stable row ID. That prevents the old signature from matching the updated row.
For legacy v0 segments on datasets with stable row IDs, optimize now uses a single task to rebuild them from live rows in the v1 format.
| if single_task { | ||
| plan.read_version | ||
| } else { | ||
| source_version |
There was a problem hiding this comment.
Taking the minimum source dataset_version can incorrectly mask a freshly indexed overlay row: a merge-only repro changes fast_search from [12] to [] without any data update. Please preserve source freshness or refresh stale rows before advancing the merged segment’s version.
There was a problem hiding this comment.
@zhangyue19921010 Thanks for pointing this out. Taking the minimum source version can indeed hide an overlay row that a newer segment has already indexed.
Scalar filtering re-evaluates stale rows even with fast_search, whereas FTS, vector, and MinHash searches skip that fallback. MinHash is closer to FTS in its ranked-search semantics, so I’d prefer to keep their behavior aligned.
MinHash’s previous optimize path updated or rebuilt the index using current data, incorporating overlay changes. The physical-merge path used by bounded optimize instead reuses stored entries without refreshing overlays and retains the oldest source version. The current FTS and vector merge paths use the same policy.
I’ve opened #11180 to track this shared limitation. I propose keeping this PR consistent with the existing FTS merge behavior and addressing overlay freshness across all three index types together in that follow-up.
3bae158 to
ed8fcf6
Compare
ed8fcf6 to
bccc4c7
Compare
Part of #10847. A bounded `optimize_indices` (`max_rows_per_task` / `max_rows_per_segment`) now splits a BloomFilter index into tasks and merges its segments by their zones; before, the whole index stayed in one task, and the single-process `merge(N >= 2)` rebuilt the segments by rescanning the column. The new `merge_bloomfilter_indices_with_new_data`, next to the unchanged `merge_bloomfilter_indices`, keeps each segment's zones and null rows over its live fragments and trains zones for the new rows with the trainer `update` uses. `merge_scalar_indices` takes this path for two or more segments, and the planner adds BloomFilter to `segment_has_merge_primitive`. Segments merge by zones only when each records its null rows and shares the build parameters (read from the file metadata without loading zones), when none holds zones of a fragment that an in-place column rewrite took out of its coverage (read from the zones' fragment ids, including fragments a deferred compaction has since moved), and when the table has no tagged fragment reuse history, no compaction remap pending on them and no segment in a shallow clone's base; otherwise the index stays one task, as before. Out of scope, since `main` has them too: #10986 (the default optimize keeps a rewritten fragment's old null rows through `update`) and #10987 (a segment outside the merge keeps answering for a rewritten fragment once another segment indexes it). This PR is independent of #10884 (MinHashLSH): both touch `segment_has_merge_primitive` and the module docs, so whichever lands second rebases mechanically. --------- Co-authored-by: Xuanwo <[email protected]>
bccc4c7 to
a3f4e1b
Compare
a3f4e1b to
633a1b5
Compare
There was a problem hiding this comment.
The current physical row address handling from merged #9858 fixes the stale shallow-clone match. The rebased planner also retains the rebuild in one task for legacy segments on datasets with stable row IDs.
The freshness concern remains: split merges of segments with different dataset versions can hide freshly indexed overlay rows from fast_search. This is confined to the weak consistency search mode; ordinary searches still rescore these rows correctly. Use ordinary search when updated-row visibility is required.
zhangyue19921010
left a comment
There was a problem hiding this comment.
LGTM Thanks for this change!
Summary
Enable bounded distributed optimize for MinHash LSH when
max_rows_per_taskormax_rows_per_segmentis set.Part of #10847.
dataset_versionso ordinary queries can mask stale signatures and score current overlay values. Single-task optimize refreshes stale signatures during the build.Testing
91 focused Rust tests passed. Workspace Clippy on macOS arm64 stopped on existing unreachable-code diagnostics in lance-encoding.