Repository navigation
feat(plan): plan DML on FULLTEXT/vector-indexed tables with the new DML planner - #33110
Conversation
Cover DELETE shapes, transactions and PK UPDATE on tables with sync IVF_FLAT, classic FULLTEXT and MASTER indexes, and DELETE on tables with async IVF_FLAT, FULLTEXT2 and HNSW indexes. Each statement checks that the hidden index tables reference exactly the live primary keys. Related to matrixorigin#21790, matrixorigin#21791. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A plain DELETE on a table with any irregular index fell back to the legacy planner. Async (CDC-maintained) indexes need no in-statement maintenance, so only fall back when the table has an irregular index that is not async: HNSW, CAGRA, IVF-PQ, FULLTEXT2 and async IVF_FLAT / FULLTEXT now use the modern binder. Related to matrixorigin#21790, matrixorigin#21791. Co-Authored-By: Claude Opus 5.5 <[email protected]>
DELETE on a table with a synchronous IVF_FLAT, classic FULLTEXT or MASTER index fell back to the legacy planner unless it had RETURNING. Materialize the deleted rows the way DELETE ... RETURNING does and delete their hidden index entries from that image, so every DELETE uses the modern binder. An irregular index without modern maintenance still falls back. Deleting 500k of 1M rows with IVF_FLAT(128), MASTER and FULLTEXT indexes takes 0.96 s instead of 1.33 s. Related to matrixorigin#21790, matrixorigin#21791. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…indexes A primary-key change now re-keys synchronous IVF_FLAT and classic FULLTEXT hidden entries in the same statement, using the delete-by-old-key and final-image insert maintenance that MASTER already uses. This removes the matrixorigin#25617 rejection, including for UPDATE ... RETURNING. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… sub-plans DELETE statements the modern binder does not plan (foreign keys, multi-table DELETE) and FK actions now maintain FULLTEXT, IVF_FLAT and MASTER indexes with the delete-by-key and final-image insert sub-plans of the modern DML planner. The legacy per-algorithm delete code and the unused post-DML fulltext path are removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- UPDATE on a parent maintains the synchronous FULLTEXT, IVF_FLAT and MASTER indexes of the child rows its foreign key actions change, instead of rejecting the statement. - REPLACE on a parent queues the child index maintenance it plans before createQuery for finishIrregularIndexMaintenance; planning it in place panicked in filter pushdown. - A SET NULL action that excludes the CASCADE-owned rows plans its own delete instead of merging into the CASCADE delete, which dropped the index rebuild of the nulled rows (regular secondary indexes included). - reduceSinkSinkScanNodes folds sinks in step order; folding a consumer before its producer in map order left a dangling sink scan. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A root UPDATE also rebuilds the irregular indexes that its self-referencing ON UPDATE CASCADE / SET NULL actions change on merged rows. - REPLACE foreign key actions see the target's irregular indexes, so a self-referencing cascade drops the hidden entries of the deleted rows. - Delete-by-key joins on FULLTEXT, IVF_FLAT and MASTER hidden tables push an exact runtime filter into the hidden-table scan, as the removed legacy deletes did. - A queued delete keeps its source projection, so the primary key stays at its column position after createQuery. - One sync/async classifier serves DELETE and UPDATE routing, and one updated-row projection serves both delete-source layouts. 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? |
|
Queue requested — the merge queue status continues in this comment ↓. |
…rigin#33113) Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
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: dd1b67fe7be624e43e74bc5d5ebae0affa37b407
Assessment: approve
Revision 2 resolves the prior design finding by documenting which row stream owns each hidden-index write, how deferred maintenance preserves column positions, and how rollback and CDC handle the resulting writes. The implementation reuses the existing maintenance helpers across planner routes and keeps asynchronous indexes on CDC.
Model: gpt-6.2-sol / xhigh
Session: 01a1f0a0-5126-78f3-9ab8-ef4e87f2f119 · slot 0 · generation 3
Validation:
-
Nine focused planner tests passed, including legacy DELETE rejection for unsupported synchronous indexes, runtime-filter association, and sink folding. See planner-focused.jsonl and receipt checks/1795465006194406160-5.json.
-
All 404 checks passed across the three shipped SQL cases for synchronous DML, foreign-key actions, and asynchronous DELETE. See cpu-bvt.jsonl, the three mo-tester reports, and receipt checks/1795465133500498402-5.json.
-
Verified the frozen source, isolation preflight, native inputs, receipt correspondence, and all six discussion dispositions. See verification.log and receipt checks/1795465273662576721-6.json.
-
The author supplied passing real-device logs for eight CAGRA and IVF-PQ SQL cases and the GPU classifier test. The GPU fixtures and build fixes match the tested revision. The later legacy classifier change preserves the registered GPU algorithms’ asynchronous path.
Limitations:
-
Local SQL validation used one embedded CPU CN. GPU execution relied on the author’s logs, and the reported DELETE speedup was outside local validation.
-
The retained plain-child controls reproduced the inherited two-cascade REPLACE planner rejection on the prior reviewed head and the merge base. Revision 2 also records the SET NULL grandchild and overlapping indirect-action limitations.
✅ Merged into
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #21790 #21791 #33108
What this PR does / why we need it:
Design: docs/design/20261123-new-dml-irregular-index-maintenance.md, design revision 2 / contract R1 (review required). It records the index classes, the maintenance invariant, row-stream ownership per planner route, ordering of queued maintenance, transaction and CDC semantics, and the supported shapes.
DELETE and primary-key UPDATE on tables with FULLTEXT or vector indexes now run on the new DML planner (bind_* + MULTI_UPDATE) for every index type, and foreign key actions keep the child tables' indexes exact.
no data receiver for sink node).Validation: BVT
dml/delete/delete_irregular_index_sync,pessimistic_transaction/vector/delete_async_irregular_indexandforeign_key/fk_irregular_indexcheck after each statement that every hidden table has no orphan and no missing key; the dml, foreign_key, fulltext, vector, array, ddl and pessimistic_transaction suites pass;pkg/sql/planandpkg/sql/compileunit tests pass.GPU:
gpu_cases/pessimistic_transaction/vector/vector_cagra_dml_irregularandvector_ivfpq_dml_irregularrun the same DELETE, PK UPDATE and FK-action paths on CAGRA and IVF-PQ; both pass on GPU, as do the existing GPU async/delete cases (logs). The GPU build also neededcreateResultBatch(proc.Mp())incagra_create_gpu.go/ivfpq_create_gpu.go, which #33052 missed on main.Limits: #33109 (REPLACE with a SET NULL grandchild) fails without any index and is not addressed here.
🤖 Generated with Claude Code