Repository navigation
feat: filtered vector search modes pre/post/iterative/auto on hnsw, cagra, ivfpq and ivfflat (#28988) - #30127
Conversation
…igin#28988) Design for pre, post and auto filtering on hnsw, cagra, ivfpq and ivfflat: itopk/max_itopk and nprobe/max_nprobe knobs by index family, a per-algorithm advanced search over the unchanged regular search, membership pre-filter for hnsw/cagra/ivfpq, hybrid fulltext + vector, the GPU no-CPU-fallback policy, and the per-algorithm short-page matrix. Design only; no code. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main renders an unparameterized BIGINT column as bigint in DESC; the GPU-only vector_cagra and vector_ivfpq results still expected BIGINT(64). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…in#28988) PR1 of the filtered vector search series. searchplugin.MembershipHooks lets an algorithm declare that its search applies a membership key set inside the index search; indexplugin.SupportsMembership replaces the ivfflat name checks in the MATCH / membership-join gate and the membership-join sort context. Only ivfflat declares it, so plans are unchanged. An explicit mode=pre or mode=auto on an index without the capability (hnsw, cagra, ivfpq) is now rejected instead of silently ignored. Planner tests that set mode=pre on cagra/ivfpq exercised the post path and now say post. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rixorigin#28988) PR2 of the filtered vector search series: BY RANK WITH OPTION accepts itopk and max_itopk on every vector index and nprobe and max_nprobe on IVF indexes (searchplugin.ProbeKnobsHooks, declared by ivfflat and ivfpq); the wrong family, a non-positive value or a start above its cap is an error. itopk sets the candidate budget to max(itopk, LIMIT), lowered to max_itopk; the search still runs once. nprobe replaces probe_limit for that query. The session variables vector_itopk, vector_max_itopk and vector_max_nprobe default the knobs. They are read for every execution and never stored in a reusable plan or compiled scope: a local scan reads them when it builds its request, and the coordinator writes them into the per-message scan copy it sends to another CN. IndexSearchScan gains internal_topk, max_internal_topk and max_nprobe; a scan carrying any of them requires MORPC 112 (vectorscan.SearchKnobsProtocolVersion), others keep 111. EXPLAIN prints the set knobs; a scan without them prints as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rigin#28988) HNSW declares the membership capability. mode=pre and MATCH-filtered top-k use the PRE shape (SEMI join + membership runtime filter), now built by a builder shared with ivfflat. The search applies the member set inside the usearch traversal, and hnsw/advsearch.go widens the requested count (predictive start, doubling, max_itopk cap) through the new AdvancedSearchHooks. mode=auto on hnsw is rejected. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n#28988) The CAGRA graph build is not deterministic; with graph_degree 8 the itopk=1000 search can return 502..511 instead of 501..510. The case checks that itopk fills the page. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…atrixorigin#28988) buildAdaptiveVectorTop, generalized from the ivfflat AUTO builder, builds ADAPTIVE_TOP [post, pre, force] for any capable algorithm; hnsw uses it for an explicit mode=auto and leaves out pre when it would equal post (no filter, or a MATCH filter). Each branch binds its index search under the smallest free mo_<algo>_alias_N, so non-adaptive plans keep their alias. post stays one search. Removes the statement-level auto retry (ErrVectorNeedRetryWithPreMode, Output.IsAdaptive, rewriteAutoModeToPre): no plan set IsAdaptive. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…xorigin#28988) ivfflat.AdvancedSearch implements AdvancedSearchHooks and drives every multi-round ivfflat search in the reader: include mode (same round sizes as before) and pre on one reader, which now continues the centroid cursor until it holds the candidate budget, probes every list, or reaches max_nprobe; under a membership set the first round's nprobe is raised from lists*budget/|S|. A PRE search split across readers keeps its one shared round. mode=pre whose filters all run in the index search (no membership join) is marked multi-round, so a primary-key-only filter widens instead of returning the qualifying rows of the first nprobe lists only. Removes the unread RuntimeConfig.BucketExpandStep. Co-Authored-By: Claude Opus 5.5 <[email protected]>
) A query vector whose centroid distances tie or are not numbers (a zero vector under cosine) made the brute-force centroid ranking list some centroids twice and others never, so include-mode rounds returned duplicate rows; pre now runs in rounds too. completeCentroidRanking keeps the first occurrence of each centroid id and appends the missing ones in id order. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…origin#28988) The bare-query comparison against the merge-base builds ADAPTIVE_TOP: auto's pre branch now fills pages it used to pass to force. Claim 1 names the pre searches that widen. Co-Authored-By: Claude Opus 5.5 <[email protected]>
) mode=pre is the filter inside one index search, as on main; mode=iterative (pgvector's iterative scan) widens the search in rounds up to max_itopk / max_nprobe, on every index with membership support. - ivfflat: iterative uses INCLUDE columns; a scan whose filters all run in the index search is multi-round, a membership search carries ScanOptions.Iterative and widens on a reader that holds the whole search. mode=include is ivfflat's alias of iterative and no longer emits the include-only first-round limit (rows unchanged). - hnsw: the widening rounds run only for ScanOptions.Iterative; pre is one membership search. - mode=include is rejected on hnsw, cagra and ivfpq; mode=iterative on an index without membership support. Compared with the merge-base on 3,852 ivfflat queries: pre, auto, post, the default mode and force return main's rows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…28988) cagra and ivfpq apply no membership key set; they declare the new IndexFilterHooks capability, and pre / iterative / auto run on their existing GPU filter of INCLUDE columns and the primary key, with other filters after the search. - iterative: CagraSearch / IvfpqSearch run the rounds of cagra.AdvancedSearch (itopk x2) and ivfpq.AdvancedSearch (nprobe x2) when the GPU filter holds every filter (ScanOptions.Iterative). - auto: ADAPTIVE_TOP [post, pre, force] through buildAdaptiveModeTop, shared with hnsw; pre only when a filter reads an INCLUDE column. - post sends only primary-key predicates into the search, as ivfflat. - EXPLAIN prints the GPU filter as SQL (Index Filter). - ivfpq: the host post-filter always runs; skipping it when the filter admitted 4*limit rows returned excluded rows whenever the probed lists held fewer qualifying rows, failing the distance check (also on main). - RuntimeConfig.Widen is renamed Iterative. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…#28988) - The mode and knob check runs once an index proves it serves the query: a mode an unused index rejects failed the query, in map order when the table has several vector indexes. - Session knobs are stamped only for an algorithm that uses them, so a fulltext search no longer needs MORPC 112 while vector_itopk is set. - ivfflat iterative bounds a search by the member count only for an exact set; a bloom set's false positives stopped it early. - EXPLAIN prints filter numbers with their JSON digits. - mode=include is admitted by capability (membership and index filter); the equi-join rewrite accepts iterative and include. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # pkg/sql/compile/compile2_test.go # pkg/vectorindex/cagra/plugin/search/search_test.go # pkg/vectorindex/ivfpq/plugin/search/search_test.go
…aim (matrixorigin#28988) Rewrite the design doc as one design with one status and one decision log. Map every claim to a black-box test and add the missing ones: ivfflat INCLUDE-column placement per mode and the post force fallback, the vector_max_nprobe session knob after PREPARE, cagra default/post index filter and auto, and auto run as bare top-k queries (a wrapped auto region runs force). explain_format_json checks candidate_limit instead of the removed first_round_limit expression. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
# Conflicts: # pkg/defines/const.go
… rows An async REINDEX runs cagra_create / ivfpq_create in parallel pipelines. An instance whose reader receives no rows never creates a builder, and end() called DeviceDemand on the nil builder: the panic failed the ISCP build iteration. Such an instance persists nothing and now returns early. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
mo-bot review · Commit: Review completed. Read the assessment. |
aunjgr
left a comment
There was a problem hiding this comment.
APPROVE at e4d14ef5cd14ced507178dc8156e7d76e9edf90d.
My previous IVF-PQ nontermination finding is resolved. The revised policy uses the built index's list count, treats an overflow-only generation as one exhaustive round, bounds its target by indexed rows/membership, saturates doubling, and observes cancellation between rounds. Inline DDL now runs the same required-option validation as standalone CREATE INDEX. The termination tests include the original five-rows/LIMIT-ten case, unknown lists, explicit caps, membership, exhausted rows and integer saturation; the GPU SQL regression retains a below-LIMIT result oracle.
Design review passes for the revised bounded-round contract in docs/design/20261012-filtered-vector-search.md at this head. The per-algorithm policies appropriately distinguish resumable IVF-flat scanning from restarted HNSW/cuVS searches. The documented short-page, approximate-ranking, cap and fallback behavior is not an unconditional recall guarantee. I accept the recorded between-round delete snapshot and unsupported/provider/volatile-region exact-sort choices.
Implementation review covered mode/knob binding and execution-time session resolution, optional plugin capabilities, shared PRE membership and AUTO plan construction, physical readers, iterative policies, C-owned membership admission/lifetime, native membership masks and prepared-mask ownership, sharded/overflow searches, IVF-PQ sentinel post-filtering, centroid permutation and wire consumers. In particular:
- PRE declines scan/membership regions with sequence or volatile expressions before duplicating them; the public sequence controls check evaluation count as well as rows.
- Prepared masks do not retain Go membership buffers, partial preparation cleans up, asynchronous workers retain their mask owners, and newly appended rows outside a prepared mask remain excluded.
- Search knobs require the dedicated current-main successor epoch 123, including execution-time session defaults, destination recheck, the actual stream and receiver decode. Unrelated searches do not acquire that requirement.
I found no remaining blocking correctness, lifecycle or plugin-boundary issue. Reused qualifying CI and the source-qualified CPU/GPU, native, race and public SQL evidence supplied for these closures, checking the subsequent main-integration/epoch changes separately. I did not rerun CUDA workloads, a real predecessor-binary cluster or production recall/latency benchmarks locally; this approval does not turn the reported measurements into universal performance claims.
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: e4d14ef5cd14ced507178dc8156e7d76e9edf90d
Assessment: approve
Reviewed the complete 214-file delta and surrounding owners/callers. The design passes: shared membership and planner ownership are coherent, algorithm-specific iteration is bounded, and replaced retry/default paths are removed. Prior protocol, termination, GPU-evidence and stateful-predicate concerns are closed. No actionable findings remain.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1
Validation:
-
Verified the frozen patch, clean HEAD and 11,592 tracked build entries. Design PASS is recorded for blob 0975a5b16de583c14c5947f0c8ed9b62965a6262 in review-notes.json.
-
Isolation preflight, fresh CPU native build and repository-native provenance verification passed.
-
46 selected top-level CPU tests passed, covering membership/admission, iterative bounds, planner modes, stateful PRE predicates, execution-time knobs and prior-protocol rejection. focused-cpu.log matches checks/1792427876306348198-5.json, exit 0.
-
Native bitmap and sorted64 tests passed, including boundaries and malformed inputs. native-tests-run.log matches checks/1792427765294308103-3.json, exit 0; the earlier loader configuration failure was corrected.
-
Reconciled retained author GPU evidence: 228 native tests passed, 411 top-level Go tests passed with seven skipped, and GPU BVT passed 1268/1268 plus 481/481. Independently verified unchanged native, CUDA-binding, membership and GPU search/policy sources since that run.
-
Frozen exact-head CI reports successful Ubuntu unit tests, native builds, static analysis and proxy/multi-CN BVT. These statuses supplement the inspected execution evidence.
-
Source/log/receipt audit passed: checks/1792427902751036163-4.json. Detailed mappings and hashes are retained in validation-audit.json under /home/xupeng/.local/state/mo-bot/jobs/3fdc0bb11a62d4d9591d58db/attempt-1.
Limitations:
-
GPU evidence is an author run at f9dcc0c, accepted only for unchanged paths. It used one physical GPU; logical sharding ran, while physical multi-GPU tests were skipped.
-
No local full SQL suite or GPU run was performed. The latest planner guard has local regression coverage and exact-head CI coverage.
-
Host-mask reuse avoids repeated filtering, but iterative rounds still upload masks and restart searches. PRE adds membership materialization; approximate modes can return short pages at configured caps. Author timing improvements lack retained baseline measurements and are not independently certified.
-
Issue #28988's original body was absent; its behavioral contract was assessed from the supplied PR, design and discussion.
… knob tests Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
mo-bot review · Commit: Review completed. Read the assessment. |
aptend
left a comment
There was a problem hiding this comment.
Re-review at exact head f7e034895608b3e7b3ea59a906df64a45f7a6435, base/merge-base 7c146f4adbf068dd0c06b377157cfb7d7698b1eb; fresh upstream main 309f618995af4ee23e3b9149365f4af77264090d.
The previous runtime findings are closed. My remaining REQUEST_CHANGES is a narrow validation gate for the newly changed GPU-only empty-input completion path, not a claim of another observed GPU defect and not a request to rerun unchanged CUDA/benchmark suites.
I read all 11 historical reviews (including my dismissed review at f37479f), 17 discussion comments and their embedded GPU receipts, all inline replies and all three resolved/unresolved threads. Reconciled the current 214-file PR scope with the previously fully reviewed 209-file scope and the subsequent feature commits/upstream interactions. The 524-line amended design passes independently; “proposed” is not itself a blocker.
Closure and new validation:
- PRE replay: the common scan/membership-subtree guard is reached by all four algorithms before PRE duplication; scalar filters retain indexed search. The 32-case final-plan test, changed fulltext membership controls and inline-index default validation PASS.
- Independent real public SQL: five modes × ordinary/binary PREPARE all return [1] and currval=1 with a fresh sequence per query. This reruns the original counterexample and adds protocol-path controls; 10/10 PASS (single-CN fixture 5.500s). Historical pre-fix failures remain in my retained prior review logs.
- Dedicated epoch124 follows main123; actual compiler destination re-probe, execution-stream handshake, receiver decode and no-knob control PASS.
- Full owning CPU plan/compile/vectorscan/indexplugin packages PASS; focused vet-all compile checks PASS. Fresh worktree-local native build, Linux amd64 Go1.27.1, repository CGo wrapper.
- Reused prior native/filter/membership/policy and race evidence only for unchanged relevant source paths. The inspected author GPU artifacts at f9dcc0c cover 228 native tests and the earlier GPU Go/BVT paths; they are not a whole-current-head GPU pass after later build/persistence/empty-end changes. No new performance claim or physical multi-GPU certification.
| Q | Closure |
|---|---|
| Q1 | Existing reader-owned membership, last-share native release and deferred prepared-mask cleanup retain their prior source-qualified proof. Traced new empty end() guard through successful builder construction and CDC-tail production: no new demonstrated ownership defect. |
| Q2 | Previously repaired finite rounds, saturation, overflow-only terminal and between-round cancellation remain; protocol refusal controls pass. No new hang claim. |
| Q3 | Existing admission/reservation and per-round caps remain; no new accumulating owner. No new OOM claim. |
Please supply only the scoped new GPU-tagged test evidence detailed inline (or recover equivalent post-change evidence). CPU CI does not compile this test. No production source was changed; review-only SQL probe will be removed. The unresolved flag on the old sequence thread is not being treated as evidence that its now-tested fix is absent.
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-xupeng · review
Commit: f7e034895608b3e7b3ea59a906df64a45f7a6435
Assessment: request_changes
Confirmed an allocation-boundary defect in the new IVF-flat search-knob path: an accepted oversized itopk causes a query panic despite LIMIT 1.
Model: gpt-6-astra / xhigh
Session: 01a15209-2c6d-71e2-b8f3-aa17387fa283 · slot 2 · generation 0
- P2
pkg/sql/colexec/vectorscan/knobs.go:106: An IVF-flat index-only query projects an INCLUDE column and uses LIMIT 1 BY RANK WITH OPTION 'itopk=18446744073709551615', in default or PRE mode.
Impact: The unchecked knob becomes CandidateBudget and reaches make([]any, 0, roundLimit) in ivfflat/search.go:879. It panics before scanning entries; pipeline recovery converts this into an internal query error. Validate or safely bound allocation budgets before allocation, and add a regression covering INCLUDE projection with a small SQL limit and oversized itopk.
Evidence: The diagnostic planner test confirmed both modes emit IncludedColumns=[title], CandidateLimit=1 and InternalTopk=MaxUint64 without a separate first-round cap. The retained ApplySearchKnobs probe confirmed the unbounded request budget. A matching reader probe passed with budget 1 but failed with MaxUint64: 'makeslice: cap out of range', through plan_reader.go:552 and search.go:879. Logs: attempt-2/included-budget-plan-v2.log and included-budget-reader.log; receipts: 1792466443673178121-4.json (exit 0) and 1792466530660436873-4.json (exit 1).
Validation:
-
Isolation preflight and repository-owned native provenance verification passed for the exact candidate.
-
Reconciled attempt-1 focused CPU evidence: 31 top-level tests passed across nine packages, covering membership, iterative bounds, planner modes, stateful predicates and search-knob protocol handling. Receipt: attempt-1/checks/1792465856027712532-3.json; log: focused-cpu-official.log.
-
Reconciled successful native bitmap/sorted64 tests with attempt-1/checks/1792465558833996039-3.json and native-tests-run.log.
-
Source, receipt, log and additive-overlay audit passed. Commands, hashes and outcomes are retained in /home/xupeng/.local/state/mo-bot/jobs/6fcdc018d93c171296a5d24e/attempt-2/review-audit.json; audit receipt: checks/1792466709496080021-4.json. Source remained unchanged.
Limitations:
-
The counterexample combines planner, binding and production-reader probes; no SQL-server execution, server crash or OOM is claimed.
-
The GPU-only empty-end regression was not executed locally. Older author GPU logs do not establish a current-head pass; missing execution alone is not a finding.
-
The confirmed defect establishes this decision before exhaustive approval of remaining CUDA/sharding, concurrency, performance and full SQL behaviors across the 214-file delta.
-
Issue #28988's original body was absent from supplied evidence; its contract was assessed from the PR, design and discussion.
Main took MORPC 124 (TIMESTAMPADD SECOND); the search knobs move to the next version (vectorscan.SearchKnobsProtocolVersion). plan.pb.go regenerated. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sized itopk An itopk above the indexed rows (up to the largest uint64) reached ivfflat as the round limit: the INCLUDE result buffers were preallocated by it (makeslice panic), sortAndLimitExactResults compared it as an int (negative, unbounded capacity), and the storage Top-K limit above the largest int was ignored by the reader, which then returned no distance column. The buffers use SearchResultPreallocate, the compare stays unsigned, and the storage limit is at most the largest int (every row). Tests: TestIvfSearchIncludeModeOversizedRoundLimit, TestSortAndLimitExactResultsOversizedLimit, TestScanEntriesOversizedLimitKeepsStorageTopK (all fail without the fix); BVT itopk=18446744073709551615 on ivfflat INCLUDE (default and pre), hnsw, ivfpq and cagra (error above 1024). Design doc claim 22. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # pkg/pb/plan/plan.pb.go
|
Thanks. Both reviews on Oversized itopk (XuPeng 5580418382)Confirmed and fixed.
The other algorithms were already safe:
The BVT now proves this for all four. Tests, all failing without the fix:
Design doc: the knobs section says a budget above the indexed rows searches every row and names how each algorithm bounds it. Claim 22 lists these tests. GPU evidence for
|
| Suite | Passed |
|---|---|
cases/vector |
3286 (2 ignored) |
gpu_cases/vector |
1289/1289 |
cases/pessimistic_transaction/vector |
659 (42 ignored) |
gpu_cases/pessimistic_transaction/vector |
481/481 |
🤖 Generated with Claude Code
|
mo-bot review · Commit: Review completed. Read the assessment. |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-xupeng · review
Commit: ca27304ffe2eda7a54ede7e01c2ae676d65f4b59
Assessment: approve
Reviewed the complete 216-file delta, callers, ownership, compatibility, failure paths, tests, documentation and supplied discussions. No actionable findings remain. Shared planning and bounded search policies replace the competing retry path. Prior concerns about protocol versioning, volatile-expression replay, unbounded IVF-PQ rounds, empty GPU builds and oversized limits are addressed.
Model: gpt-6-astra / xhigh
Session: 01a15209-2c6d-71e2-b8f3-aa17387fa283 · slot 2 · generation 0
Validation:
-
Verified the pinned source remained unchanged. Isolation preflight and a fresh CPU native build passed, including repository-owned native provenance verification.
-
Passed 99 top-level tests in the focused CPU selection and 16 supplemental planner/protocol tests, covering membership, iterative limits, PRE replay, session knobs, AUTO planning and prior-protocol refusal.
-
The complete docfilter package passed under the Go race detector: 35 top-level tests, no skips. Native cbitmap and sorted64 probes also passed.
-
Independently decoded the generated protobuf descriptor; changes match the declared schema. Reviewed SQL regression expectations and confirmed older IVF fixture migrations contain only mode-alias and comment changes.
-
Audited retained GPU provenance and logs reporting 228 passing C++ tests. Reused that evidence only for native code and bindings verified unchanged at this head. Historical GPU Go/BVT results were distinguished from current-head execution.
-
Reconciled commands, source fingerprints, exit receipts and retained logs in /home/xupeng/.local/state/mo-bot/jobs/e9afca373506da1f70b9741b/attempt-1/validation-summary.json. An initial native-probe library-path failure was retained separately; the corrected execution passed.
Limitations:
-
No local GPU or SQL-server/BVT execution. Supplied current-head CI statuses were reviewed, but raw CI logs were unavailable; historical GPU BVT results do not establish exact-head execution.
-
No independent performance benchmark or physical multi-GPU validation; numerical performance claims are not certified.
-
The linked issue body was absent from frozen evidence. Behavioral requirements were assessed against the PR description, design document and supplied discussions.
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: ca27304ffe2eda7a54ede7e01c2ae676d65f4b59
Assessment: approve
Reviewed the complete 216-file delta, design, callers, tests and frozen discussion. Ownership is coherent: the shared planner constructs PRE/AUTO plans, each index controls bounded widening, and native membership/masks own asynchronous lifetimes. Obsolete statement retries are removed. Prior protocol, overflow termination, stateful-filter replay, oversized-limit and GPU empty-finalization concerns are closed. No actionable findings remain.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
Validation:
-
Verified the frozen patch matches the assigned base and head; the source checkout remains unchanged. Reviewed generated protobuf code and independently decoded its descriptor to confirm only the intended field changes.
-
Private-runtime preflight and current-source native build passed. Current-head Go execution passed 14 top-level tests and 32 subtests across ivfflat, compile, plan and vectorscan, using -count=1 and the supplied test-exec. Receipts: 1792517690117839425-4, 1792517744993639657-5 and 1792517911973900205-5; retained logs match their commands and source fingerprints.
-
Reconciled earlier same-PR native and 46-test CPU evidence. Verified all nine retained GPU attachments by hash: 228 C++ tests, 411 top-level Go passes with seven skips, and historical GPU BVT results of 1268/1268 and 481/481. Reuse is limited to independently confirmed unchanged paths, not treated as whole-current-head execution.
-
Frozen author evidence at f93f7f0 supplies GPU empty-finalization pass/failing-control output and owning-package results; the relevant source trees match this head. The current-head CI snapshot reports successful required CI, Ubuntu UT, native builds, proxy BVT and pessimistic BVT; raw CI logs were not independently inspected.
-
Evidence reconciliation passed under receipt 1792518470053579047-3. Detailed design/risk assessment, audit, receipts and copied evidence are retained under /home/xupeng/.local/state/mo-bot/jobs/70c0c54a2cd8c5713e4abf36/attempt-1. Initial native-reuse setup rejection was recovered through a fresh repository-owned build and was not counted as a product failure.
Limitations:
-
No local GPU or full SQL-suite rerun. Physical multi-GPU behavior is not established by single-device logical sharding; latest author BVT totals remain reported evidence without separate retained logs.
-
PRE adds membership materialization and potentially another scan; graph/GPU widening repeats bounded search work. Prepared masks reduce repeated host filtering, but no speedup or large-concurrency performance claim was independently benchmarked.
-
The original issue #28988 body was absent; requirements were assessed from the frozen PR, design and discussion. Missing older raw probe/race artifacts were excluded from verified execution claims.
Main took the next MORPC version (LOAD IGNORE foreign-key check); the search knobs move to the next free one (vectorscan.SearchKnobsProtocolVersion). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merge Queue Status
This pull request spent 8 minutes 1 second in the queue, with no time running CI. ReasonPull request #30127 has been dequeued Queue conditions are not satisfied:
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Requeued — the merge queue status continues in this comment ↓. |
Main took the next MORPC version (information_schema.VIEWS definitions); the search knobs move to the next free one (vectorscan.SearchKnobsProtocolVersion). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merge Queue Status
This pull request spent 2 hours 25 minutes 57 seconds in the queue, including 1 hour 28 minutes 3 seconds running CI. Required conditions to merge
|
|
@Mergifyio queue |
☑️ Command
|
QA verification on
|
| Query | Result |
|---|---|
exact scan oracle: where cat=1 order by l2_distance(v,'[0,0]') limit 2 |
10, 11 |
... order by l2_distance(...) limit 2 by rank with option 'mode=pre' |
10, 11 |
mode=post |
10, 11 |
mode=iterative |
10, 11 |
mode=auto |
10, 11 |
All four modes agree with the exact-scan oracle, and none returns the near-but-filtered-out rows.
Visibility controls on the same index: after DELETE of the nearest neighbour the deleted row disappears (5,2,3); after INSERT of a new nearest it is returned first (6,5).
Not covered: recall/EF trade-offs at scale (tested with ≤ 12 rows), GPU algorithms (cagra, ivfpq), and concurrent DML during index scans.
What type of PR is this?
Which issue(s) this PR fixes:
issue #28988
What this PR does / why we need it:
A filtered vector top-k could return a short or empty page while qualifying rows exist (issue fixture: hnsw 0 of 10; recall@10 0.18 hnsw / 0.33 ivfflat vs 0.998 pgvector iterative scan).
mode=pre|post|autowas honored by ivfflat only. Design:docs/design/20261012-filtered-vector-search.md; every claim there names its BVT.Pre-filtering. The index search filters inside the search in two ways:
A filter neither covers runs after the search (post-filtering).
Modes on all four vector indexes.
post: one index search; only primary-key filters run inside it.post, plus INCLUDE-column filters inside the search (unchanged).pre: one search with every filter it can pre-filter. INCLUDE-column and primary-key filters run in the search on ivfflat, cagra and ivfpq; other filters go through membership on all four indexes. A distance range predicate (l2_distance(v, q) < K) runs on the search output and never builds the PRE shape. An ivfflatprewhose filters are all on INCLUDE columns or the primary key builds no JOIN.iterative:prethat widens while the page is short, up tomax_itopk/max_nprobe(pgvector's iterative scan).auto:ADAPTIVE_TOP [post, pre, force]on every index, pre omitted when it equals post.include(ivfflat's earlier name foriterative, feat(ivfflat): add INCLUDE column support for IVF indexes #24168) is accepted as an alias ofiterativeon every index, so existing queries keep running.Membership key set. The membership producer scan also applies the filters the index search evaluates, so the key set holds only rows that pass every filter (fewer keys; on ivfflat a set of 100 keys or fewer is searched exactly in every list).
Membership in C memory (hnsw, cagra, ivfpq).
docfilter.NewForCbuilds a cbitmap when eligible, otherwise whichever of CRoaring and C sorted64 is estimated smaller; the estimate is reserved with the CN memory admission before the build and released on the lastFree. Onemo_membership_t(cgo/membership.h) is shared by usearch and cuVS. cuVS probes it per row againsthost_idsinside the existing CPU mask pass (cbitmap read in place, CRoaring/sorted64contains, no extra allocation), ANDed with the INCLUDE/pk predicates and the deletes, then one upload. A membership needs int64host_ids; a Go-memory filter is an error. The filter mask and its delete copy are reserved with the admission when together they are 1 MiB or more.iterativestops atmin(LIMIT, members).Filter mask built once per iterative search (cagra, ivfpq).
prepare_bitsetbuilds the host filter mask (membership AND INCLUDE/pk predicates AND deletes; one per index, shard and CDC overflow) once; every round of amode=iterativesearch uses it throughsearch_quantize_with_bitset, instead of rebuilding and re-uploading it per round. Go:Bitset/MultiBitset,PrepareBitset,SearchQuantizeWithBitset. The deletes are those at prepare time.upload_host_masknow clears bits past the mask (raft's bitset defaulted to all set, so rows appended after a mask was built passed the filter) and clamps the copy to the shard.Knobs.
BY RANK WITH OPTION 'itopk=…', 'max_itopk=…', 'nprobe=…', 'max_nprobe=…'by index family, session variablesvector_itopk,vector_max_itopk,vector_max_nproberesolved per execution (aSETafterPREPAREapplies).nprobeis 1..80000 (theprobe_limitrange); an unknown option key is an error. On cagraitopkandmax_itopkare at most 1024, the most keys one cuVS CAGRA search returns: a larger BY RANK value is an error, a larger session value is lowered to 1024 (the session variables are shared with hnsw); theiterativedefault cap is 1024 (20000 on hnsw). EXPLAIN shows the knobs and the filter the index search applies (Index Filter).Iterative search. One Go policy per algorithm (
pkg/vectorindex/<algo>/iterative.go,searchplugin.IterativeSearchHooks) over the unchanged regular search, run only formode=iterative; hnsw/cagra/ivfpq restart with doubled knobs, ivfflat continues its centroid cursor. Every policy has a terminal round: ivfpq caps at the list count of the built index (MultiGpuIvfPq.NLists; an overflow-only generation stops after its first round, which searches every row) and at the indexed rows; doubling saturates; cagra/hnsw/ivfpq stop on a canceled statement between rounds.Capabilities.
MembershipHooks/IndexFilterHooks/InternalTopKLimitHooksreplace algorithm-name checks; the mode check runs only for the index that serves the query.Hybrid fulltext. hnsw, cagra and ivfpq serve a
MATCH+ vector top-k through the PRE shape (both indexes, exact matching rows). On every index the PRE shape runs a filter-onlyMATCHonce, in the membership producer: main's perf(plan): avoid duplicate MATCH searches in IVFFLAT PRE #30178 row-fetch removal (ivfflat) lives in the sharedbuildVectorPreFilterJoinon this branch and covers hnsw, cagra and ivfpq too.Single evaluation under PRE. The PRE shape runs the scan's filters in the membership producer and on the row-fetch scan. When those filters or the membership join read a sequence or volatile expression (
nextval,rand(), ...), every index leaves the query to the exact sort, which evaluates them once per row, asautoalready runsforce(vectorPreFilterReplaySafe).Wire.
IndexSearchScan.internal_topk,max_internal_topk,max_nprobewith a dedicated MORPC version,vectorscan.SearchKnobsProtocolVersion(the single reference to the number; shared with no other feature); required only when a knob is set, and stamped only for algorithms that use it.RankOptioncarriesnprobeat field 2, as on main.Fixes found on the way.
INDEX i USING ivfpq(v)without options took theDefaultOptionshook, which has nolists, bypassingParamsFromTree'slists > 0rule;mode=iterativeon such an index with a short page never terminated (reproduced on GPU SQL). An index declared without options now takes the plugin'sParamsFromTreeof an empty option list, asCREATE INDEXdoes;DefaultOptionsis removed (ivfflat/hnsw/cagra params unchanged).mode=iterativewideneditopkpast 1024 when fewer thanLIMITrows qualified on a table over 1024 rows, and cuVS failed with "topk must be lower than or equal to 1024";itopkabove 1024 is now an error.FilterEmptyInProbedListsPadsWithSentinels).bucket_windows=0:n) instead of thenprobelists.mo_sorted64_build_fixedrejects an element size other than 1/2/4/8 and skips a truncated item.cagra_create/ivfpq_createin parallel pipelines; an instance that received no rows calledDeviceDemandon a nil builder inend(), and the panic failed the ISCP build iteration. It now returns early (TestCreateEndWithoutRows).itopkabove the indexed rows (up to the largest uint64) panicked an INCLUDE search (makeslice: cap out of range) and, in the default mode, lost the storage Top-K distance column. The result buffers are preallocated with a bound, and the storage Top-K limit is at most the largest int (every row). hnsw and ivfpq already bound the search by the index rows; cagra rejects anitopkabove 1024.Removed the unused statement-level auto retry (
rewriteAutoModeToPre).Behavior changes against main:
preruns INCLUDE-column filters in the index search instead of through membership: more qualifying rows per round, but no exact membership set, so a filter that only a few rows (100 or fewer) pass can return a short page whereiterativefills it (short-page matrix).preanditerative(and a membership join orMATCHfilter) run filters outside the INCLUDE columns through membership, in the GPU search, instead of after it.mode=includeruns asmode=iterativeon every index (on main it changed behaviour only on ivfflat).listsis refused, asCREATE INDEXalready refuses it.mode=forcestays the exact CPU sort: it bypasses the index, so it is not a GPU search. A GPUvector_matmulforce was measured and rejected: one query on 1M × 768 vecf32 took 1.07 s on the GPU and 0.19 s on the CPU (the GPU is 5.6× slower).Tests
prepare_bitset: C++PreparedBitsetSearch(cagra, ivf_pq, brute force),PreparedBitsetSearchSharded,PreparedBitsetExcludesRowsAddedAfterPrepare(fails with the all-set upload); GoTestGpu{Cagra,IvfPq,BruteForce}PreparedBitset,TestMultiGpu{Cagra,IvfPq}PreparedBitset(race-count55–100). 1M × 768 bench,mode=iterative: ivfpq with a 99% filter 61.0 → 57.5 ms mean (A/B/A), ivfpq with a 0.1% filter 18.4 → 16.7 ms; single-round searches unchanged. The per-round saving is the mask pass over the index rows (~3 ms at 1M rows with a 990k-key membership), so it grows with table size × rounds.BVT:
cases/vector/vector_filtered_search_{hnsw,ivfflat,modes,knobs}.sql,vector_hybrid_fulltext.sql;gpu_cases/vector/vector_filtered_search_gpu.sql,vector_filtered_search_knobs_gpu.sql,vector_hybrid_fulltext_gpu.sql,vector_cagra_itopk_limit.sql. Fullcases/vector,gpu_cases/vector,cases/fulltext,cases/optimizer/explain_format_json.sql,pessimistic_transaction/vectorpass at 100% (156 files).Unit tests across the touched packages (GPU build; membership tests also 100× under
-race); C++ cuVS tests (223/223) for the ivfpq post-filter and the membership mask (EvalFilterMembershipTest,Gpu{Cagra,IvfPq}Test::FilteredSearchAppliesMembership); C testcgo/test/test_sorted64.c.Iterative termination:
TestIterativeSearchTerminates(omitted lists / overflow only, filter below LIMIT, known lists,max_nprobe, all indexed rows, full page, members, saturation; fails on the previous policy),TestInlineVectorIndexWithoutOptionsUsesParamsFromTree(inline DDL equalsParamsFromTree, ivfpq refused),TestMultiGpuIvfPqPreparedBitset(NLists).GPU BVT added:
gpu_cases/pessimistic_transaction/vector/vector_filtered_search_overflow_gpu.sql(built index + CDC overflow under membership, primary-key and subquery filters, pre and iterative, cagra and ivfpq),vector_ivfpq_iterative_overflow.sql(inline ivfpq without lists refused; overflow-only iterative below LIMIT),gpu_cases/vector/vector_sharded_filtered.sql(sharded pre/iterative membership across shards).Protocol fence:
TestSearchKnobScopeRefusesPriorEpochDestination— a knob scope whose frozen destination reports the prior version is refused at the send-time re-probe, on the execution-stream handshake and on receiver decode; a no-knob scope still runs there.1M × 768 (cagra / ivfpq, median ms): no filter 5.9 / 3.5; cbitmap 500k keys 41.8 / 36.4; cbitmap 1k 22.9 / 6.7; CRoaring 10k 26.1 / 24.5; C sorted64 150 keys 33.3 / 20.3; no returned row fails the filter.
🤖 Generated with Claude Code