Repository navigation
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.
发现一个滚动升级下的阻塞性正确性问题:新增 AlterTableRenameCol.checks 字段没有对应的 MORPC 协议版本门禁,当前 MORPCLatestVersion 仍为 13。滚动升级期间新 CN 可能连接旧 TN;旧 TN 会成功解码并跳过未知字段,rename 仍会提交,但 TN 持久化的 SchemaExtra.Checks 保留旧列名,而 CN 保存新列名,导致重启/缓存刷新后元数据分叉,SHOW CREATE 和后续 ALTER 可能失败。
建议:为 CHECK-aware rename 分配新的协议版本(例如 v14),在包含 CHECK(包括 legacy CREATE SQL 恢复出的 CHECK)时,协议低于该版本直接 fail closed;补充 v13 reject/v14 accept 及旧 TN 解码器反例测试。
其余 ALTER COPY key 去重、CHECK AST 重写、TRUNCATE self-FK sentinel 修复未发现新的阻塞问题。常规 CI 通过,但 upgrade compatibility jobs 被跳过,未覆盖该混部场景。
gouhongshen
left a comment
There was a problem hiding this comment.
Codex automated review
Supported CHANGE COLUMN renames still bypass the new CHECK rewrite and fail during copy; the existing unresolved protocol-gating review was not duplicated.
P1 - CHANGE COLUMN renames do not rewrite CHECK metadata (pkg/sql/plan/build_alter_rename_column.go:116)
The recovery/rewrite is wired only into the RENAME COLUMN path. A different-name CHANGE COLUMN is forced to COPY and dispatched to ChangeColumn, whose updateNewColumnInTableDef path never rewrites checks. Thus CHECK(a < b) remains stale after CHANGE a TO x; ConstructCreateTableSQL emits the old reference for the temporary table, causing the ALTER to fail or leave inconsistent metadata. Add equivalent handling and a regression test for CHANGE COLUMN with CHECK.
|
Addressed both blocking reviews in dd4973f:
Decision log: CHANGE COLUMN does not need the v14 gate because it uses the existing COPY path and does not send AlterTableRenameCol.checks. The sender-side RENAME gate is intentionally retained in addition to the planner gate to cover synthesized or cached plans. Validated focused tests, full pkg/defines, pkg/pb/api, pkg/sql/plan, pkg/sql/compile, pkg/vm/engine/tae/catalog, and pkg/vm/engine/disttae tests; go build/vet; make build; and a local SQL harness for the CHANGE COLUMN CHECK case. |
|
Addressed the latest review finding and rebased onto current The panic came from
The visitor now skips absent optional operands while preserving traversal of all present children. Added direct AST coverage, planner coverage through Post-rebase validation passed:
|
gouhongshen
left a comment
There was a problem hiding this comment.
Codex automated review
Prior blockers are fixed: protocol-v15 CHECK transport gating, CHANGE/COPY CHECK recovery, source-identity key deduplication, and nil-safe CASE traversal. The earlier COPY compatibility concern is non-blocking because gating is now INPLACE-only. A new independent blocking panic remains in generic CHECK rewriting.
P1 - Renaming a column panics on a planner-accepted MATCH CHECK (pkg/sql/plan/build_alter_rename_column.go:300)
This call traverses every persisted CheckDef.OriginSql, even when the renamed column is unrelated. The current DDL binder accepts CHECK (MATCH(body) AGAINST ('foo')): it handles FullTextMatchExpr, registers FULLTEXT_MATCH overloads, and validateCheckExpr does not reject it. Re-parsing the stored SQL yields FullTextMatchExpr, whose Accept implementation unconditionally panics at pkg/sql/parsers/tree/expr.go:1958-1960. Thus ALTER TABLE t RENAME COLUMN body TO body2 can panic in the planner. This is distinct from the resolved CASE finding: CASE's optional operands are now nil-safe, while FullTextMatchExpr.Accept itself still panics. Implement non-panicking traversal for accepted CHECK forms, or reject MATCH-containing CHECKs before persistence with a controlled error.
e4b20de to
86af0de
Compare
|
Addressed the latest AST traversal review on rebased head I expanded the audit from the reported node to the complete persisted-CHECK visitor boundary:
Reachability note: the review claim that current DDL persists The remaining unimplemented AST visitors are outside persisted CHECK input: generated-column binding rejects subqueries; validation rejects variables and parameters; binding rejects Interval, ExprList, and StrVal; DEFAULT/UPDATE/MAX/SAMPLE/SET forms are not produced by CHECK grammar. This is the decision boundary for this PR. Validation after the final rebase/edit: focused and full tree/plan packages, build/vet for both, |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed exact head 86af0de against base 5a753ba.
All previously blocking paths are closed:
- ALTER COPY now retains target PK/UNIQUE dedup whenever type conversion, generated-column recomputation, or source-column replacement can change key values; same-name DROP/ADD is covered by source-identity proofs on both planner and compiler paths.
- RENAME/CHANGE rewrites persisted CHECK SQL, legacy recovery is fail-closed on SQL-mode ambiguity, and INPLACE CHECK transport is gated at MORPC v15 at both planning and sending boundaries. CN rollback and TN schema persistence carry cloned CHECK metadata.
- The CASE optional operands are nil-safe. The latest traversal change also closes the reachable LIKE ESCAPE child omission. FullTextMatch/Param traversal is bounded and does not regress the existing RETURNING qualifier visitor.
- TRUNCATE correctly excludes the table-ID-zero self-FK sentinel while retaining real parent refreshes.
I independently checked the prior MATCH report: current CREATE CHECK binding rejects MATCH before persistence with ambiguous column reference, so it was not a current legal catalog path. The new visitor support still makes legacy or synthesized metadata non-panicking.
Non-blocking follow-up: alterCopyKeyColumnValueUnchanged and its compiler counterpart do not compare plan.Type.Charset, unlike the canonical text-type equality contract. Current PK/UNIQUE dedup remains raw-byte based, so this is not a present integrity blocker, but Charset should be included before key equality becomes collation-aware.
Validation on the exact head: full tests and go vet passed for pkg/defines, pkg/pb/api, pkg/sql/parsers/tree, pkg/sql/plan, pkg/sql/compile, pkg/vm/engine/disttae, and pkg/vm/engine/tae/catalog. The branch is based directly on current main and is mergeable. CI was still in progress at review time with no reported failure; this approval does not depend on waiting for it.
iamlinjunhong
left a comment
There was a problem hiding this comment.
Reviewed exact head 86af0de against base 5a753ba.\n\nNo P0-P3 findings remain. I verified the ALTER COPY key-value/source-identity dedup gates, CHECK recovery/rewrite and v15 CN/TN transport, the complete persisted-CHECK AST traversal boundary (including CASE and LIKE ESCAPE), rollback ownership, and the TRUNCATE self-FK sentinel path. The final rebase is patch-equivalent for the prior six commits, the AST follow-up closes the reachable traversal omission, and all 26 checks are terminal with no failures.
gouhongshen
left a comment
There was a problem hiding this comment.
Codex automated review
No remaining findings. Prior blockers are resolved: v15 fail-closed CHECK-rename gating, legacy CHECK recovery/rewrite, source-identity key deduplication, nil-safe CASE/MATCH/parameter/ESCAPE traversal, and self-FK TRUNCATE handling. The COPY gate concern was correctly narrowed to INPLACE and is non-blocking. The remaining Charset comparison note is accepted as non-blocking under current raw-byte PK/UNIQUE encoding.
Merge Queue Status
This pull request spent 36 minutes 12 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #26893 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?
Which issue(s) this PR fixes:
issue #26853
issue #26839
issue #26838
What this PR does / why we need it: