Repository navigation
refactor(plan): make UPDATE planner routing explicit - #26373
Conversation
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review complete. Explicit UPDATE planner routing is closed over the current UnsupportedDML sources, unknown reasons cannot expand the legacy allowlist, Iceberg remains specialized, and telemetry contains only bounded route fields. Existing multi-table/JOIN behavior remains routed to the legacy planner. Full pkg/sql/plan and pkg/util/metric/v2 tests pass; required CI is green and the exact head merges cleanly with current main.
Merge Queue Status
This pull request spent 1 hour 39 minutes 20 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #26373 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
Failing checks:
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. Tick the box to put this pull request back in the merge queue (same as
|
) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26337 ## What this PR does / why we need it: `bindAndOptimizeUpdateQuery` previously treated any propagated `ErrUnsupportedDML` as permission to invoke the legacy UPDATE planner. That allowed new binder errors to expand the legacy surface accidentally. This change: - introduces typed UPDATE planner routes with stable machine-readable reasons; - allows `buildTableUpdate` only for explicitly classified legacy reasons; - keeps Iceberg as a named specialized route; - rejects writable external tables and unsupported table forms explicitly; - makes unknown `ErrUnsupportedDML` values visible without falling back; - records planner, reason, and result through `mo_sql_update_planner_route_total` and structured logs without SQL text or values; - adds executable binder/plan fixtures for all known route classes and the unknown-route guard; - confirms that `SET + AUTO_INCREMENT` is legal while `ENUM + AUTO_INCREMENT` is rejected. Legacy UPDATE use can be monitored with: ```promql sum by (planner, reason, result) ( rate(mo_sql_update_planner_route_total{planner="legacy"}[5m]) ) ``` Validation: - `.agents/skills/mo-dev/scripts/mo-cgo-test -p=2 -count=1 -timeout=600s ./pkg/sql/plan` - `go test -p=2 -count=1 -timeout=300s ./pkg/util/metric/v2` - `.agents/skills/mo-dev/scripts/mo-cgo-test -p=2 -race -count=1 -timeout=900s ./pkg/sql/plan` - `go test -p=2 -race -count=1 -timeout=600s ./pkg/util/metric/v2` - `make static-check` - `git diff mo/main...HEAD --check` Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26337 ## What this PR does / why we need it: `bindAndOptimizeUpdateQuery` previously treated any propagated `ErrUnsupportedDML` as permission to invoke the legacy UPDATE planner. That allowed new binder errors to expand the legacy surface accidentally. This change: - introduces typed UPDATE planner routes with stable machine-readable reasons; - allows `buildTableUpdate` only for explicitly classified legacy reasons; - keeps Iceberg as a named specialized route; - rejects writable external tables and unsupported table forms explicitly; - makes unknown `ErrUnsupportedDML` values visible without falling back; - records planner, reason, and result through `mo_sql_update_planner_route_total` and structured logs without SQL text or values; - adds executable binder/plan fixtures for all known route classes and the unknown-route guard; - confirms that `SET + AUTO_INCREMENT` is legal while `ENUM + AUTO_INCREMENT` is rejected. Legacy UPDATE use can be monitored with: ```promql sum by (planner, reason, result) ( rate(mo_sql_update_planner_route_total{planner="legacy"}[5m]) ) ``` Validation: - `.agents/skills/mo-dev/scripts/mo-cgo-test -p=2 -count=1 -timeout=600s ./pkg/sql/plan` - `go test -p=2 -count=1 -timeout=300s ./pkg/util/metric/v2` - `.agents/skills/mo-dev/scripts/mo-cgo-test -p=2 -race -count=1 -timeout=900s ./pkg/sql/plan` - `go test -p=2 -race -count=1 -timeout=600s ./pkg/util/metric/v2` - `make static-check` - `git diff mo/main...HEAD --check` Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26337 ## What this PR does / why we need it: `bindAndOptimizeUpdateQuery` previously treated any propagated `ErrUnsupportedDML` as permission to invoke the legacy UPDATE planner. That allowed new binder errors to expand the legacy surface accidentally. This change: - introduces typed UPDATE planner routes with stable machine-readable reasons; - allows `buildTableUpdate` only for explicitly classified legacy reasons; - keeps Iceberg as a named specialized route; - rejects writable external tables and unsupported table forms explicitly; - makes unknown `ErrUnsupportedDML` values visible without falling back; - records planner, reason, and result through `mo_sql_update_planner_route_total` and structured logs without SQL text or values; - adds executable binder/plan fixtures for all known route classes and the unknown-route guard; - confirms that `SET + AUTO_INCREMENT` is legal while `ENUM + AUTO_INCREMENT` is rejected. Legacy UPDATE use can be monitored with: ```promql sum by (planner, reason, result) ( rate(mo_sql_update_planner_route_total{planner="legacy"}[5m]) ) ``` Validation: - `.agents/skills/mo-dev/scripts/mo-cgo-test -p=2 -count=1 -timeout=600s ./pkg/sql/plan` - `go test -p=2 -count=1 -timeout=300s ./pkg/util/metric/v2` - `.agents/skills/mo-dev/scripts/mo-cgo-test -p=2 -race -count=1 -timeout=900s ./pkg/sql/plan` - `go test -p=2 -race -count=1 -timeout=600s ./pkg/util/metric/v2` - `make static-check` - `git diff mo/main...HEAD --check` Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
issue #26337
What this PR does / why we need it:
bindAndOptimizeUpdateQuerypreviously treated any propagatedErrUnsupportedDMLas permission to invoke the legacy UPDATE planner. That allowed new binder errors to expand the legacy surface accidentally.This change:
buildTableUpdateonly for explicitly classified legacy reasons;ErrUnsupportedDMLvalues visible without falling back;mo_sql_update_planner_route_totaland structured logs without SQL text or values;SET + AUTO_INCREMENTis legal whileENUM + AUTO_INCREMENTis rejected.Legacy UPDATE use can be monitored with:
Validation:
.agents/skills/mo-dev/scripts/mo-cgo-test -p=2 -count=1 -timeout=600s ./pkg/sql/plango test -p=2 -count=1 -timeout=300s ./pkg/util/metric/v2.agents/skills/mo-dev/scripts/mo-cgo-test -p=2 -race -count=1 -timeout=900s ./pkg/sql/plango test -p=2 -race -count=1 -timeout=600s ./pkg/util/metric/v2make static-checkgit diff mo/main...HEAD --check