Skip to content

fix(frontend): allow binary prepare for single SET assignment - #26694

Merged
mergify[bot] merged 5 commits into
matrixorigin:mainfrom
LeftHandCold:fix/issue-25996-binary-set-prepare
Aug 4, 2026
Merged

fix(frontend): allow binary prepare for single SET assignment#26694
mergify[bot] merged 5 commits into
matrixorigin:mainfrom
LeftHandCold:fix/issue-25996-binary-set-prepare

Conversation

@LeftHandCold

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 #25996

What this PR does / why we need it:

Binary COM_STMT_PREPARE wraps the client payload as PREPARE <name> FROM <statement>. The prepareable grammar admitted SELECT/DML statements but not SET, so PrepareContext("SET @binary_value = ?") failed with ERROR 1064 before parameter binding even though #26096 already supports planning and executing prepared SET expressions.

This patch admits only SET with one variable assignment in that grammar and regenerates the MySQL parser. The regression goes through the real ExecRequest(COM_STMT_PREPARE) path, verifies the retained tree.SetVar plan and parameter metadata, and confirms binary multi-assignment remains rejected.

The single-assignment boundary is intentional: prepared multi-assignment currently has a separate panic and partial-update atomicity defect tracked by #26685. This PR does not expose that known path or change SET execution semantics.

Tested with:

go test -mod=readonly ./pkg/sql/parsers/dialect/mysql -count=1

go test -mod=readonly ./pkg/frontend -count=1 -timeout=10m

go vet -mod=readonly ./pkg/sql/parsers/dialect/mysql ./pkg/frontend

go test -mod=readonly -race ./pkg/frontend -run "^TestExecRequestStmtPrepareAcceptsSetVariable$" -count=100

go test -mod=readonly -race ./pkg/frontend -run "^TestPreparedSetBinaryProtocolReportsAndReplacesParameters$" -count=100

go test -mod=readonly -race ./pkg/sql/parsers/dialect/mysql ./pkg/frontend -count=1

The parser generator completed with zero conflicts. CGo-transitive frontend commands used the repository third-party include/library and libmo linker configuration.

@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 review complete on exact head 223255882c8cbad48c661967f067ec3071a59d52; no blocking finding.

The grammar change closes only the binary COM_STMT_PREPARE entry gap by admitting one SET var_assignment. Multi-assignment remains rejected before planning, so this does not expose the separate #26685 panic/partial-update path. The real ExecRequest(COM_STMT_PREPARE) regression proves the retained tree.SetVar, one parameter slot, and rejection of two assignments.

The generated parser is reproducible from mysql_sql.y (only goyacc's output-path header differs when generated into a temp file) and reports zero conflicts. Exact-head validation: owning packages list/build/vet pass; full parser and frontend tests pass; focused test passes 10x and race passes 3x; git diff --check is clean.

Q1: the test-owned session and prepared statement are closed by the existing session lifecycle; no production resource owner changes. Q2: no new wait edge. Q3: a failed multi-assignment prepare is not installed in the prepared-statement registry, so no new accumulation path.

@iamlinjunhong iamlinjunhong 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.

Reviewed the complete diff on exact head 223255882c8cbad48c661967f067ec3071a59d52. No P0, P1, P2, or P3 findings.

The new grammar branch admits exactly one SET var_assignment for the internal binary COM_STMT_PREPARE wrapper and constructs the same tree.SetVar used by the existing prepared-SET planner/executor path. A second top-level assignment remains a syntax error before planning, so this change does not expose the separate multi-assignment panic/partial-update path tracked by #26685. I also traced prepare registration, parameter metadata, execution-time expression binding, authorization, and session cleanup; the patch does not add a resource owner, wait edge, or hot-path work outside parsing.

Validation on this head: goyacc regeneration completed with zero conflicts and matched the committed parser body; git diff --check is clean; the MySQL parser package build, vet, and full tests passed locally. All 26 GitHub checks are complete with no failing or pending check, including the frontend/owning-package CI coverage.

@XuPeng-SH

Copy link
Copy Markdown
Contributor

@Mergifyio refresh

@mergify

mergify Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

refresh

✅ Pull request refreshed

@mergify mergify Bot added the queued label Aug 4, 2026
@mergify

mergify Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-08-04 08:52 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • Checks failed · in-place
  • 🚫 Left the queue2026-08-04 10:02 UTC · at 16c22842c93e2eca446c2ddab4ec58ba18180ea4

This pull request spent 1 hour 9 minutes 51 seconds in the queue, with no time running CI.

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

The merge conditions cannot be satisfied due to failing checks

Failing checks:

Hint

You may have to fix your CI before adding the pull request to the queue again.
If you update this pull request, to fix the CI, 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.

Requeued — the merge queue status continues in this comment ↓.

@mergify

mergify Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-08-04 16:29 UTC · Rule: main · triggered by @VioletQwQ-0 with the merge queue checkbox
  • Checks passed · in-place
  • Merged2026-08-04 17:14 UTC · at 37100d7de72bcb1ec79bdb3d51888c848d6304ca · squash

This pull request spent 45 minutes 12 seconds in the queue, including 41 minutes 59 seconds running CI.

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

…set-prepare

# Conflicts:
#	pkg/sql/parsers/dialect/mysql/mysql_sql.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants