Repository navigation
Description
Background
MatrixOne currently has two general UPDATE planning paths:
- the modern
bindUpdatepath, which producesMULTI_UPDATE; - the legacy
buildTableUpdatepath, selected whenbindAndOptimizeUpdateQuerycatches almost anyErrUnsupportedDML.
On current main, this is a broad catch-all rather than a typed planner decision. For example, ResolveUpdateTables calls ResolveTables(..., respectFKCheck=false), so any target carrying Fkeys or RefChildTbls falls back even when the UPDATE changes no FK-related column and even when foreign_key_checks=0.
This fallback is production-reachable. A real-server reproduction on current main showed that adding FK metadata changes the same nullable-UNIQUE UPDATE from a successful MULTI_UPDATE plan to the legacy PreInsert UniqueKey plan, where #26334 causes a false duplicate-key error.
Maintaining two independent UPDATE DAG builders also multiplies correctness work for generated columns, assignment casts, joined-row deduplication, locking, FK actions, and index maintenance.
Goal
Converge supported UPDATEs on the modern MULTI_UPDATE architecture. Each UPDATE must have one explicit disposition:
- modern
MULTI_UPDATE; - a named specialized planner where the storage model requires one (currently Iceberg row-level DML); or
- an explicit user-facing rejection before locks or mutations.
The end state has no generic ErrUnsupportedDML -> buildTableUpdate routing.
Scope
- Fix [Bug]: nullable index UPDATE keeps Rowid from filtered NULL row #26334 immediately so the reachable legacy path is safe during migration.
- Inventory and instrument every current legacy UPDATE route.
- Select the route from statement/table capabilities and the columns actually updated, not from broad metadata presence.
- Port FK validation/actions, multi-target UPDATE, synchronous irregular-index maintenance, and supported special cases.
- Preserve atomicity, locking, affected-row, generated-column, partition, and hidden-index semantics.
- Remove only UPDATE-specific legacy code after call-graph proof that it is unreachable.
Non-goals
- Removing INSERT, DELETE, LOAD, REPLACE, FK, or index utilities that remain independently reachable.
- Forcing unsupported storage/table forms through
MULTI_UPDATE. - Changing SQL compatibility or weakening FK/index validation as part of the planner migration.
Work breakdown
Recommended order and dependencies:
- [Bug]: nullable index UPDATE keeps Rowid from filtered NULL row #26334 — Phase 0: fix the nullable-index Rowid alignment bug independently; do not wait for planner retirement.
- [Subtask]: Inventory and instrument legacy UPDATE planner fallbacks #26337 — Phase 1: inventory, classify, and instrument every legacy UPDATE route.
- [Subtask]: Move child-side foreign-key UPDATE validation to MULTI_UPDATE #26338 — Phase 2: route FK-bearing updates by affected columns and implement child-side FK validation.
- [Subtask]: Move parent-side FK referential actions to MULTI_UPDATE #26339 — Phase 2: port parent-side FK actions.
- [Subtask]: Move multi-target UPDATE semantics to MULTI_UPDATE #26340 — Phase 2: port multi-target UPDATE while reusing existing modern joined-update safeguards.
- [Subtask]: Move synchronous irregular-index UPDATE maintenance to the modern planner #26341 — Phase 2: port synchronous irregular-index maintenance through plugin contracts.
- [Subtask]: Migrate remaining legacy UPDATE special cases or reject them explicitly #26342 — Phase 2: resolve all remaining special/error cases.
- [Subtask]: Cut over to MULTI_UPDATE and remove the legacy UPDATE planner #26343 — Phase 3: remove the generic fallback and proven UPDATE-only legacy code.
Acceptance criteria
-
bindAndOptimizeUpdateQueryhas no generic fallback tobuildTableUpdate. - Every previously reachable route is covered by an executable plan test and resolves to
MULTI_UPDATE, a named specialized planner, or an explicit pre-mutation error. - FK handling is column-sensitive and preserves the defined
foreign_key_checksbehavior. - FK RESTRICT/NO ACTION, CASCADE, SET NULL, self-reference, and recursive cases are atomic and maintain affected indexes.
- Multi-target UPDATE preserves per-target Rowid filtering/deduplication, final-row-image semantics, lock order, and affected-row behavior.
- Synchronous FULLTEXT/IVF maintenance is correct; async algorithms keep their CDC contract; unsafe synchronous-index PK updates remain rejected.
- Telemetry reports zero legacy UPDATE executions for the agreed regression/soak window.
- Shared DML operators/utilities are retained unless independent call-graph analysis proves they are dead.
- Targeted planner/colexec tests and distributed UPDATE/FK/index suites pass in the required transaction modes.
Rollout guardrails
- Land [Bug]: nullable index UPDATE keeps Rowid from filtered NULL row #26334 and route observability first.
- Replace one explicitly classified route at a time.
- Keep compatibility tests for both successful behavior and exact rejection behavior.
- Remove the legacy path only after every classified reason is closed and telemetry shows no unexplained use.
Activity