Repository navigation
fix: support insert ignore with on duplicate key update - #28482
mergify[bot] merged 10 commits into
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? |
896db06 to
c112e5a
Compare
iamlinjunhong
left a comment
There was a problem hiding this comment.
Findings
-
[P1]
pkg/sql/plan/build_constraint_util.go:2173— retain parameters inside discarded scalar subqueries.
Trigger: a prepared statement on a table without a real primary/unique key, for examplePREPARE s FROM 'INSERT INTO insert_fk_no_key_c VALUES (?, ?) ON DUPLICATE KEY UPDATE pid = (SELECT ?)', including theINSERT IGNOREform. The new reflective scan correctly detects the marker and this code binds/appends the RHS toVALUE_SCAN.OnUpdateExprs, but the final parameter walk does not recurse through that bound scalar subquery.NewVisitPlanreachesOnUpdateExprs, whileGetParamRule.applyExprinpkg/sql/plan/visit_plan_rule.go:195-223has noExpr_Subcase and therefore does not visitSubqueryRef.Child.ResetPreparePlanconsequently collects only the twoVALUESmarkers; the addedscalar subquery parametercontrols expect three and the statement cannot bind its third parameter. Explicitly retain/collect every marker in the discarded RHS (or keep the bound subquery expression graph reachable), and make both ordinary andIGNOREcontrols pass. -
[P1]
pkg/sql/plan/function/func_cast.go:6772— route truncation warnings throughproc.GetWarningSink().
Compile.Runinstalls a generation-scoped collector inProcess.WarningSink(pkg/sql/compile/compile2.go:388-392,pkg/sql/compile/warning_attempt.go:40-48), but this helper readsGetSession()directly. A warning emitted by an attempt that is later discarded/retried therefore bypasses the collector and can leak or be duplicated in the frontend; a process carrying only a capturedWarningSinkalso loses the warning. The adjacent numeric conversion warnings already useGetWarningSink(). Route this helper through that sink and add coverage for the sink-only and discarded-attempt cases.
The previous P2 Expr.Accept panic is fixed in 669951a37ec7c6a90530516bde35b9a7978e8d90, and the author explicitly replied to that earlier finding. These two current-head P1 blockers remain unresolved, so this review requests changes.
Validation: reviewed the complete current-head diff and the relevant planner, parameter-reset, warning-lifecycle, and runtime call chains. git diff --check passes. The focused native-CGo test was blocked before execution in this isolated environment by missing native headers/libraries; no local test pass is claimed.
|
Current-head CI diagnosis for
No rerun was started while the workflow still had other jobs in progress. The failed job should be rechecked from this exact head after the run reaches a terminal state. |
aptend
left a comment
There was a problem hiding this comment.
Re-review completed at exact head dffb56cbe21b9b075c2800ebaba7b4ac06e8fde0.
I read the complete review/comment/thread history and checked the delta since my previous reviewed head 669951a37ec7c6a90530516bde35b9a7978e8d90 together with the full PR diff. Both previously blocking issues are closed in the implementation: discarded no-key ODKU expressions still participate in parameter discovery/reindexing, including Expr_Sub operands and referenced subquery roots; and assignment-width warnings now flow through the execution attempt’s WarningSink, so discarded attempts do not leak diagnostics. I also rechecked the independent IGNORE/ODKU AST representation, parser round-trips, planner routing, ordered repeated assignments, no-key fallback, auto-increment provenance, and the stated failure-scope boundary.
Validation on the exact head:
git diff --check; forced MySQL parser regeneration remained clean.- Full package tests:
./pkg/sql/parsers/dialect/mysql,./pkg/sql/plan,./pkg/sql/plan/function,./pkg/frontend, and./pkg/sql/compile. - Focused race tests for prepared/subquery parameter handling and attempt-scoped warning behavior in plan, function, and compile packages.
The current GitHub coverage failure is an infrastructure checkout timeout before repository code ran. No blocking code issue found.
|
Current-head CI diagnosis for
No blind rerun is warranted for this completed runner/setup failure. |
|
This update synchronizes the PR branch with The current head:
Validation on the current head: full controlled native-bundle tests pass for the MySQL parser, plan/function, plan, compile, and frontend packages; semantic preflight schema v7 passes with the exact diff hash recorded in the PR body; and |
|
Re-review request for current head The two current-head P1 findings from the prior review are addressed:
The current exact-head semantic preflight is regenerated and validated PASS (schema v7, diff hash Please re-review the repaired P1 findings at this exact head. The PR remains |
|
Current exact-head CI review ( Ubuntu UT job I classify the current block as |
iamlinjunhong
left a comment
There was a problem hiding this comment.
按当前 head 8ad9942 完成复审,未发现可确认的 P0/P1/P2/P3 问题,提交 APPROVE。\n\n重点复核:\n- parser/AST 将 INSERT IGNORE 与有序 ODKU assignment 独立保存,并核对了各调用方的 getter 迁移;\n- no-key prepared fallback 在 pkg/sql/plan/build_constraint_util.go:2188-2211 绑定完整 ODKU RHS,保留嵌套表达式中的全部参数;\n- pkg/sql/plan/visit_plan_rule.go:195-225, 319-323, 351-359 及相关 root BFS 覆盖 Expr_Sub.Child 和引用的子查询计划;\n- pkg/sql/plan/function/func_cast.go:7015-7037, 8974-9009 使用 attempt-scoped warning sink 处理 assignment 截断告警;\n- 已复核上轮两个 P1 的作者回复及当前修复,未发现残留阻塞。
Merge Queue Status
This pull request spent 56 minutes 40 seconds in the queue, including 49 minutes 19 seconds running CI. Required conditions to merge
|
What type of PR is this?
Which issue(s) this PR fixes:
Issue #28159 (bounded first-stage compatibility; issue remains open)
What this PR does / why we need it:
Adds the first-stage
INSERT IGNORE ... ON DUPLICATE KEY UPDATEcompatibility path within the existing ODKU domain.tree.Insertan independentIgnorepolicy and keeps executable ODKU assignments ordered, including repeated targets.ON DUPLICATE KEY IGNOREspelling.Expr_Subchildren and referenced subquery roots during prepared-plan reset and normalization, so inner parameters are retained with the correct execution-time ordinal.proc.GetWarningSink()and covers sink-only execution plus warning-attempt discard behavior.Validation on current head
8ad9942cffdadc31723097d8ae4cdf87fa112bb110741bbe1c4bb0c8ece37359a9045a0a4c025553and is not reused as current-head evidence.222b92ea773feb1985f84edaebb59de60608bbeaontomain@b347a62a30719cf3f2c8ca5a2da0dcfb11639f8;git diff --checkand the parser tree focused tests — PASS.BLOCKED_ENVIRONMENTbecause the local docfilter CGo symbols/native bundle are unavailable.CHANGES_REQUESTEDand requires reviewer re-review.The prepared regressions cover ordinary and
INSERT IGNOREno-key ODKU, user variables, literal scalar subqueries, scalar subqueries containing parameters, referenced-root traversal, and one-based ordinal normalization. The warning regressions prove sink-only routing and that a discarded attempt does not publish its warning to the session.Fresh exact-head CI, distributed BVT, and QA remain required; no blind CI rerun was forced.