Skip to content

fix insert ignore - #26607

Merged
XuPeng-SH merged 33 commits into
matrixorigin:mainfrom
daviszhen:0731-fix-insert-ignore
Aug 4, 2026
Merged

fix insert ignore#26607
XuPeng-SH merged 33 commits into
matrixorigin:mainfrom
daviszhen:0731-fix-insert-ignore

Conversation

@daviszhen

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #25367

What this PR does / why we need it:

  • ENUM 在数值比较、算术和纯数字 IN 中按成员索引计算。
  • SET 在数值、位运算和纯数字比较中按位图计算。
  • 字符串函数、COALESCE、字符串比较及混合字符串 IN 保持 ENUM/SET 的显示值语义。
  • 扩展 ENUM/SET 的 planner 回归测试,覆盖数值运算、数值比较、纯数字/混合 IN、字符串函数与 COALESCE。
  • 更新 dtype/enum、dtype/set BVT 场景及对应结果快照。

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep-reviewed exact head 7532437. The previous ENUM/SET numeric-context blocker and the local/VALUES INSERT IGNORE cases are addressed, and the focused planner/function/util regressions pass. One distributed correctness blocker remains.

P1 — INSERT IGNORE adjustment state is lost at the remote-CN process boundary

The new execution-time YEAR/BIT/ENUM/SET adjustment branches all depend on statementIgnore(proc), which reads proc.GetStmtProfile().GetStatementIgnore(). The frontend sets that flag on the coordinator, but BuildProcessInfo and pipeline.ProcessInfo do not serialize the statement runtime profile, and remoterunServer.go reconstructs a fresh StmtProfile from only txnId/stmtId. Its ignore bit is therefore false.

This is reachable, not just a codec concern: INSERT IGNORE ... SELECT adds the assignment casts in a PROJECT above the source; compilePlanScope keeps PROJECT on each table-scan scope, and table-scan scopes are Remote over the generated CN nodes. If an invalid YEAR/BIT/ENUM/SET value is evaluated on a remote source scope, the same cast that adjusts locally takes its strict error branch and aborts the statement. The added BVT covers INSERT ... SELECT but does not force that projection onto a different CN, so it does not close this execution shape.

A temporary boundary regression on this head set statementRuntimeIgnore=true, built ProcessInfo, reconstructed the remote StmtProfile exactly as remoterunServer does, and asserted the remote flag. It fails: expected true, got false.

Please carry the required statement runtime semantics through ProcessInfo and restore them before remote pipeline execution, with rolling-upgrade-safe behavior, and add a forced remote/multi-CN regression alongside the local control. A minimal public witness is strict mode plus INSERT IGNORE INTO dst(bit(4)) SELECT 31 FROM a source placed on another CN: expected stored 15 without statement failure; the remote projection currently sees ignore=false and raises out-of-range.

Unhappy-path audit: Q1 ownership/transfer fails at coordinator StmtProfile -> ProcessInfo -> remote StmtProfile; Q2 aborts before the write path can apply ignore semantics; Q3 adds no growth risk, but the state-transfer contract is incomplete. diff --check is clean; focused planner, function, and util tests pass; CI is green.

@daviszhen

Copy link
Copy Markdown
Contributor Author

Deep-reviewed exact head 7532437. The previous ENUM/SET numeric-context blocker and the local/VALUES INSERT IGNORE cases are addressed, and the focused planner/function/util regressions pass. One distributed correctness blocker remains.

P1 — INSERT IGNORE adjustment state is lost at the remote-CN process boundary

The new execution-time YEAR/BIT/ENUM/SET adjustment branches all depend on statementIgnore(proc), which reads proc.GetStmtProfile().GetStatementIgnore(). The frontend sets that flag on the coordinator, but BuildProcessInfo and pipeline.ProcessInfo do not serialize the statement runtime profile, and remoterunServer.go reconstructs a fresh StmtProfile from only txnId/stmtId. Its ignore bit is therefore false.

This is reachable, not just a codec concern: INSERT IGNORE ... SELECT adds the assignment casts in a PROJECT above the source; compilePlanScope keeps PROJECT on each table-scan scope, and table-scan scopes are Remote over the generated CN nodes. If an invalid YEAR/BIT/ENUM/SET value is evaluated on a remote source scope, the same cast that adjusts locally takes its strict error branch and aborts the statement. The added BVT covers INSERT ... SELECT but does not force that projection onto a different CN, so it does not close this execution shape.

A temporary boundary regression on this head set statementRuntimeIgnore=true, built ProcessInfo, reconstructed the remote StmtProfile exactly as remoterunServer does, and asserted the remote flag. It fails: expected true, got false.

Please carry the required statement runtime semantics through ProcessInfo and restore them before remote pipeline execution, with rolling-upgrade-safe behavior, and add a forced remote/multi-CN regression alongside the local control. A minimal public witness is strict mode plus INSERT IGNORE INTO dst(bit(4)) SELECT 31 FROM a source placed on another CN: expected stored 15 without statement failure; the remote projection currently sees ignore=false and raises out-of-range.

Unhappy-path audit: Q1 ownership/transfer fails at coordinator StmtProfile -> ProcessInfo -> remote StmtProfile; Q2 aborts before the write path can apply ignore semantics; Q3 adds no growth risk, but the state-transfer contract is incomplete. diff --check is clean; focused planner, function, and util tests pass; CI is green.

  • 修复 ENUM/SET 数值上下文:不再只依赖有限 AST 形式;CAST AS SIGNED、ABS、数值列比较、BETWEEN、非字面量 IN、一元数值比较均使用内部数值,而字符串上下文仍使用显示值。
  • 完成 INSERT IGNORE 的 YEAR/BIT/ENUM/SET 调整语义:严格模式下非法值不再直接中止,按 MySQL 兼容规则调整并写入。
  • 修复远端 CN 丢失 IGNORE 状态:将该语义写入 pipeline.ProcessInfo,远端解码并重建 StmtProfile,使 INSERT IGNORE … SELECT 的远端投影也走调整逻辑。
  • 增加 UT、强制多 CN 集成测试及 BVT:验证远端 BIT(4) 溢出值可成功写入 15;补充 ENUM/SET 数值与字符串上下文对照。

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review of c716491: the previous blocker is resolved.\n\nThe statement-level IGNORE flag is now carried through ProcessInfo, restored by both codecService.Decode and the remote-run server, and re-serialized on further hops. Missing field data from an older sender decodes to false, so mixed-version execution fails closed instead of silently applying IGNORE semantics.\n\nI also verified the forced multi-CN regression actually sets ForceScanOnMultiCN and exercises an assignment cast on a remote scan scope.\n\nFocused local validation passed:\n- pkg/vm/process: ProcessInfo build/codec round-trip + legacy absent-field case\n- pkg/sql/compile: remote helper/new compile restoration\n- pkg/tests/dml: TestInsertIgnoreSpecialTypeOnRemoteCN\n\nNo blocking correctness issue found.

@mergify

mergify Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-08-04 10:59 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue2026-08-04 11:33 UTC · at 50f55a76b12151a2d241ba45c7cd73e0086f23f6

This pull request spent 34 minutes 18 seconds in the queue, with no time running CI.

Waiting for
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
    • check-success = Matrixone CI / SCA Test on Linux/arm64
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
All conditions
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
    • check-success = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86

Reason

Pull request #26607 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.

The author needs to enable "Allow edits from maintainers" on this pull request.

Failing checks:

Hint

You 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.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review of new head 50f55a7 after the main-branch merge.\n\nc71649112e365edd6831725d6ba46a4962f866dd is the first parent. The merge adds only already-merged main changes and does not modify this PR's protobuf, ProcessInfo codec, remote-run restoration, or INSERT IGNORE regression files; no conflict resolution altered the reviewed fix.\n\nExact-head focused validation passed again:\n- ProcessInfo build/codec round-trip and legacy absent-field behavior\n- remote helper/new compile statement state restoration\n- forced multi-CN INSERT IGNORE special-type integration test\n\nThe prior approval remains valid on the new head; no blocking issue found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dequeued kind/bug Something isn't working size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants