Repository navigation
feat(cagra,ivfpq): ignore and record rows the index cannot store (#31583) - #32036
Conversation
…rixorigin#31583) CAGRA and IVF-PQ now follow the ignored-rows contract HNSW got in matrixorigin#31596 (docs/design/20261028-index-ignored-rows.md): MAX_BAD_RECORDS, the ignored hidden table, SHOW INDEX IGNORED / STATUS, permanent stop past the limit, REINDEX restart, restore following the limit. Before this change one such row broke the index: with QUANTIZATION 'float16' an element of 100000 failed a CAGRA build (RAFT failure) and left IVF-PQ answering no row for any query, and a row arriving by CDC broke every later rebuild from the source. - A row is unstorable when a vecf32 element overflows float16 under float16 storage, or its squared L2 norm exceeds float32 max / 4 (both indexes compute L2 in float32). One check, cuvs.CheckStorable, used by the CDC writer and by cagra_create / ivfpq_create. - The builds plan sub-indexes from an up-front count and cuVS builds no sub-index below its minimum (CAGRA intermediate_graph_degree, IVF-PQ lists). The first minimum rows of each sub-index are held until they all arrive; rows still held at the end go to the brute-force tail. With the holding disabled the same data fails both builds. - An index without an ignored table keeps its previous behaviour. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er (matrixorigin#31583) Self-review of 22e9dfe: - A sharded build is one sub-index split (rows / devices) &^ 31 per shard, so left-out rows could leave a shard below the cuVS minimum (both builds failed on 63 stored of 66 planned rows over 2 devices). The build holds devices x the minimum rounded up to 32 (minSubIndexRows), and charges the held rows to the host memory it plans with (reserveHeldRows). - A search vector either rule rejects is rejected (cuvs.CheckQuery in both newSearch); before, CAGRA and IVF-PQ returned no row. - HNSW and both cuVS builds share one tracker of left-out rows (ignoredBuild); the cuVS builds route rows through one helper and keep the same cursor convention. Float16Overflow lives in pkg/vectorindex. - The ignored table is cleared with DELETE ... WHERE TRUE, as HNSW's; the CDC writer matches the quantization exactly, as the builds do; held vectors are released after each flush. - vector_cuvs_ignored.sql: sharded and search-vector sections; waits 120 s. 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? |
|
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-local · review
Commit: 19549c32f0e5f76435675efdb152efa54bee5500
Assessment: approve
Reviewed the complete delta, discussion and affected consumers. Ignored-row limits, transactional updates, short-subindex handling and legacy behavior are coherent. No actionable defects remain.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
Validation:
-
Isolation preflight and native builds passed with recorded source provenance.
-
Nine cuVS/plugin package suites passed; receipt checks/1793639016128940453-3.json and cpu-plugin-tests.log.
-
Focused ISCP, build-helper and HNSW tests passed in three packages; receipt checks/1793639088155426598-3.json and cpu-lifecycle-tests.log.
-
Reused the author's GPU suite report: 173/173 statements passed at 1de7d50. All 39 changed files match that revision.
-
Receipt/log reconciliation, clean frozen HEAD and complete discussion coverage verified; records saved in validation-evidence.json and discussion-assessment.json.
Limitations:
-
GPU execution was not repeated locally; supplied GPU evidence lacks raw logs and covers a single-process deployment.
-
The reported broader 1509-statement GPU run included a wait timeout and is not counted as a complete pass.
…pile tests Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sue_31583_ivfpq_cagra
🚫 Left the queue · pull request branch update failed14 min in the queue, 10 min of it CI. So far
Reason The pull request can't be updated
To get back in the queue
Requeued — the merge queue status continues in this comment ↓. 3 merge conditions met
Times in UTC · dashboard · how the merge queue works |
🚫 Left the queue · pull request branch update failed1 min in the queue, with no time running CI. So far
Reason The pull request can't be updated
To get back in the queue
Requeued — the merge queue status continues in this comment ↓. Times in UTC · dashboard · how the merge queue works |
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? |
✅ Merged into
|
#31583) (#32096) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [x] Documentation - [x] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue #31583 (IVF-Flat and FULLTEXT2; completes the issue after #32036) ## What this PR does / why we need it: IVF-Flat and FULLTEXT2 now follow the ignored-rows contract HNSW, CAGRA and IVF-PQ follow (`docs/design/20261028-index-ignored-rows.md`): `MAX_BAD_RECORDS`, the hidden `ignored` table, `SHOW INDEX IGNORED` / `SHOW INDEX STATUS`, a permanent stop past the limit, REINDEX restarting it. Before this change one row such an index cannot store failed the build or the statement, and on an asynchronous index stopped every later sync. **IVF-Flat** (decided by @cpegeric: the check and the recording live in `product_l2`; the cast stays in SQL) - **What cannot be stored**: an element beyond the range of the `QUANTIZATION` type, an int8/uint8 code that is not finite, a squared L2 norm beyond max/4 of the distance type, a NaN or infinite element. One check, `ivfflat.Storage`, serves `product_l2`, the k-means samples and the search. - `product_l2` leaves out and records such rows in every path that assigns rows to centroids: the build, the async build and its sync, REINDEX, restore, and DML on a synchronous index. The index reaches it as JSON on `CENTROIDX(optype, params, config)` (the catalog row does not exist yet during CREATE INDEX); only internal SQL may pass that form. - DML on a synchronous index follows `MAX_BAD_RECORDS` (decided by @cpegeric): within it the row is recorded, past it the statement fails. The count is the one the statement's transaction sees (decided by @cpegeric, 2026-11-04): concurrent transactions may together commit past the limit, by at most the rows each could add; every later statement that records a row then fails until rows are fixed or REINDEX runs. A lock serializing them was rejected (it serializes bad-row DML and adds a lock the DML path does not take). Deleting a row, or updating it to a value the index stores, removes its record, in DML and in the sync. - k-means skips the samples the index cannot store; fewer good samples than `lists` seed one NULL centroid, as a table with fewer rows does. A query vector the index cannot store is rejected. **FULLTEXT2** (new reason codes, decided by @cpegeric) - Text the `json` parser cannot parse (20351) and a DATALINK that cannot be read (20352: missing stage or file, unsupported url, text that cannot be extracted) are recorded with their message in the new reason column, in the build and the sync. Timeouts, lost connections and unreachable endpoints are retried; a local source for an asynchronous index stays an error, since it is a setting of the table. Keys read as users see them: a composite key as `(a, b)`, an ENUM key as its member, in `SHOW INDEX IGNORED` and in the stop messages. An index created before this change has no ignored table and keeps its SQL; its bad rows now carry the new codes. The design doc gains IVF-Flat and FULLTEXT2 sections and claims I15–I20, each with unit tests and a section of `pessimistic_transaction/vector/vector_ivfflat_ignored.sql` or `pessimistic_transaction/fulltext2/fulltext2_ignored.sql`. Known limit: an ENUM part of a composite key shows its number in the stop message (`SHOW INDEX IGNORED` shows the member). ### Validation - BVT (CPU, fresh instance, `-g -n`): `vector_ivfflat_ignored.sql` 71/71, `fulltext2_ignored.sql` 31/31; `vector` 3505/3507 (2 ignored), `pessimistic_transaction/vector` 1156/1198 (42 ignored), `fulltext2` 1374/1374, `pessimistic_transaction/fulltext2` passing. Eight existing `.result` files list the new hidden `ignored` table. - DATALINK from a remote stage (not reachable from BVT) checked live against a MinIO stage, build and sync: a missing file is recorded with `stage://ms/missing.txt: file ftdocs/missing.txt is not found`. - Unit: every touched package passes, including `pkg/sql/plan`, `pkg/sql/compile`, `pkg/iscp`, `pkg/sql/colexec/productl2`, `pkg/sql/colexec/table_function`, `pkg/vectorindex/...`, `pkg/fulltext2/...`; the new tests pass `-race -count=30`. golangci-lint: 0 issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Approved-by: iamlinjunhong <[email protected]> Approved-by: XuPeng-SH <[email protected]> Approved-by: aunjgr <[email protected]> Approved-by: fengttt <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
issue #31583 (CAGRA and IVF-PQ; IVF-Flat and FULLTEXT2 remain)
What this PR does / why we need it:
CAGRA and IVF-PQ now follow the ignored-rows contract HNSW got in #31596 (
docs/design/20261028-index-ignored-rows.md):MAX_BAD_RECORDS, the hiddenignoredtable,SHOW INDEX IGNORED/SHOW INDEX STATUS, a permanent stop past the limit, REINDEX restarting it, a restore following the limit.Before this change one row such an index cannot store broke it. Measured on a GPU with
QUANTIZATION 'float16'and an element of 100000: a CAGRA build failed withRAFT failure ... Could not generate an intermediate CAGRA graph; an IVF-PQ build succeeded and then returned no row for any query whileSHOW INDEX STATUSsaidrunning. A row arriving by incremental sync was searched from the brute-force tail and then broke every later rebuild from the source (REINDEX, restore, ALTER COPY, the scheduled reindex).cuvs.CheckStorable, serves the CDC writer, both builds and the search.intermediate_graph_degree, IVF-PQlists), so a left-out row could shorten the last sub-index, or a shard of a sharded build, below it. The build holds the first minimum rows of each sub-index (devices × the minimum rounded up to 32 when sharded) until they arrive, and rows still held at the end go to the brute-force tail, where they are searched with their INCLUDE values (decided by @cpegeric). The held rows are charged to the host memory the build plans with.ignoredBuild). An index created before this change keeps building and syncing as before.The design doc gains a CAGRA and IVF-PQ section and claims I11–I14, each with unit tests and a section of
test/distributed/gpu_cases/vector/vector_cuvs_ignored.sql, which runs every section for both indexes.Validation
gpu_cases/vector/vector_cuvs_ignored.sql173/173;gpu_cases/vector1509 statements, all passing (vector_cagra.result/vector_ivfpq.resultlist the newignoredhidden table).number of vectors per shard (15) must be larger than build_params.intermediate_graph_degree (16);IVF-PQ build requires at least n_lists vectors (got 2 vectors, n_lists=4)); without the sharded rule the sharded case fails both (CAGRA build requires at least 2 vectors (got 0);... (got 0 vectors, n_lists=4)).pkg/iscp,pkg/vectorindex,pkg/vectorindex/cuvs,pkg/vectorindex/hnsw/...,pkg/vectorindex/cagra/...,pkg/vectorindex/ivfpq/...,pkg/sql/colexec/table_functionpass with and without thegputag;pkg/sql/plan,pkg/sql/compilepass. golangci-lint v2.14.0: 0 issues with and without thegputag.Environment and run summaries
GPU: NVIDIA GeForce RTX 5070 Laptop GPU, driver 610.88, 8151 MiB;
MO_CL_CUDA=1build of 1de7d50, single-process launch, fresh data directory.🤖 Generated with Claude Code