Skip to content

feat(frontend): support prepared publication statements - #29386

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
ck89119:issue-16543-main
Sep 26, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
ck89119:issue-16543-main

Conversation

@ck89119

@ck89119 ck89119 commented Sep 26, 2026

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:

Fixes #16543

What this PR does / why we need it:

Complete prepared-statement support for publication management and inspection:

  • Route CREATE/ALTER/DROP PUBLICATION, SHOW PUBLICATIONS, and SHOW PUBLICATION COVERAGE through the existing frontend-only prepared-statement path instead of compiling an empty engine plan.
  • Share publication SHOW result schemas between PREPARE metadata and execution, using standard MySQL wire types. Preserve saved-result materialization by recognizing text BLOB-family wire metadata as internal TEXT without reclassifying binary BLOBs.
  • Keep the existing SHOW CREATE PUBLICATION query path and cover it in end-to-end regression tests.
  • Preserve execution-time authorization and publication state checks. Reject nonliteral SHOW PUBLICATIONS LIKE patterns during PREPARE; this change does not introduce parameter-marker syntax.

Tests cover PREPARE without side effects, repeated execution, missing publications, access revocation, saved results, result metadata, and reuse after errors.

Validation

  • Go 1.26.4, macOS arm64; both owning packages passed through mo-cgo-test: ./pkg/sql/plan and ./pkg/frontend.
  • Changed production coverage blocks: 33/35 statements (94.29%).
  • Incremental gofmt, go vet, and golangci-lint 2.6.2 (built with Go 1.26.4): passed.
  • New mo-tester case: 61/61, twice on the same instance with metadata comparison and verified publication/database/account teardown.
  • publication_subscription BVT directory: 1,953/1,953; save_query_result: 128/128.
  • JDBC binary-protocol probe: all six statement types verified as actual ServerPreparedStatement instances, with client fallback disabled; metadata, results, repeated execution, error recovery, and unsupported LIKE parameters passed.
  • Planner regression fails against the original baseline planning implementation.

Full-repository SCA and CI are not claimed as locally verified.

@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 completed against head b069f6b69e52968b0a75e4a6c11aa5820ed7e211 and PR base 3f0a68bd8034d37e098765920f328985c308c9ff. No blocking findings; approved.

I traced PREPARE → SQL/binary EXECUTE → frontend publication handlers → MySQL result metadata/rows → saved-result materialization → statement cleanup. The change keeps authorization and publication-state checks at execution time. Repeated execution, missing-publication errors, access revocation, and deallocation are covered by the regression cases and existing lifecycle paths. The new metadata conversion is limited to nonbinary BLOB-family wire types and does not mutate wire metadata.

Performance/maintainability: fixed-size SHOW schemas and a column-count conversion add only bounded per-statement work; the change adds no per-row scan, RPC, lock, cache, or background task. Reusing the existing handlers and sharing the two SHOW schemas keeps the implementation proportionate.

Locally verified on Linux/amd64 with Go 1.26.4 and matched CPU CGo artifacts: all six focused new tests passed; the full ./pkg/sql/plan and ./pkg/frontend test packages passed (-count=1); build, vet, and git diff --check passed. Current-head CI Required, Linux UT, SCA, coverage, and multi-CN BVT are green.

Known scope boundary: prepared SHOW PUBLICATIONS LIKE ? is rejected explicitly. Parameter-marker support can be tracked as a separate feature request; it is not a blocker for this PR or for issue #16543.

@mergify mergify Bot added the queued label Sep 26, 2026
@mergify

mergify Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-26 10:26 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-09-26 10:28 UTC · at 10c68dea2cbaa90580f6d02bb73cfc430aa70c4e

This pull request spent 1 minute 8 seconds in the queue, with no time running CI.

Reason

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

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.

Waiting for any of
  • check-neutral = CI Required
  • check-skipped = CI Required
  • check-success = CI Required
All conditions

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 merged commit 9c79a6e into matrixorigin:main Sep 26, 2026
20 of 21 checks passed
@mergify mergify Bot added dequeued and removed queued labels Sep 26, 2026
@ck89119
ck89119 deleted the issue-16543-main branch September 26, 2026 11:09

This branch was previously deployed

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

Labels

kind/feature size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Prepared statement support for publication management and inspection

3 participants