Skip to content

fix(ctl): classify invalid flush targets and missing databases - #31792

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
aptend:fix/astra-meow-31663
Oct 29, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
aptend:fix/astra-meow-31663

Conversation

@aptend

@aptend aptend commented Oct 29, 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 #31663

What this PR does / why we need it:

The TN-backed mo_ctl('dn', 'flush', ...) handler reported malformed targets as internal failures and could expose the storage engine's OkExpectedEOB sentinel for an unknown database. It now returns invalid-input error 20301 with a bounded usage hint for malformed targets, and translates only that missing-database sentinel to 1049/42000. Other storage/relation errors, service and privilege checks, and valid numeric/table/tenant targets keep their existing behavior.

The malformed-target echo is limited to a 64-byte prefix with a truncation marker. Native regressions drive the real handler with TN metadata, check preserved error identity and decoded successful request payloads, and verify a valid request still works after rejection. A SQL regression checks successful flushes, error classifications and reuse of the same connection.

Validation on the final source:

  • Normal pkg/sql/plan/function/ctl package: original exit 0, 67 PASS rows, no skips or failures; scoped incremental static check: 0 issues.
  • Real mo-tester CI comparison mode: 15/15 twice on one private instance; database/catalog cleanup checked between and after runs, with frozen expected output unchanged.
  • Real wire checks cover 20301, 1049/42000, unchanged missing-table 1146, successful flushes and connection reuse. Source/binary identity, owned TCP/UDP/HAKeeper/seed/JDBC targets and foreground cleanup were independently reviewed, including cleanup after a controlled validation exception.

@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 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: dd61c240e5f252576ea202fd76deb4cd5d719346

Review completed. Read the assessment.

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

mo-bot review · mo-bot-local · review

Commit: dd61c240e5f252576ea202fd76deb4cd5d719346

Assessment: approve

The fix correctly classifies malformed flush targets and missing databases while preserving valid requests and other errors. No actionable defects found.

Model: gpt-6-astra / xhigh

Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2

Validation:

  • Full ctl package passed, including all nine new tests and an additional UTF-8/boundary probe; no skips or failures.

  • Reused successful frozen-head static-analysis and BVT evidence; confirmed SQL case selection.

  • validation-audit.json matches retained logs to successful receipts and verifies native inputs, probe provenance and unchanged source.

  • Complete discussion assessed and required review records saved.

Limitations:

  • Raw CI logs and author local-validation artifacts were unavailable.

  • Author-reported wire checks, BVT repetition and cleanup checks were not independently repeated.

@mergify mergify Bot added the queued label Oct 29, 2026
@mergify

mergify Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue

1 h 17 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Thu 29 Oct, 21:24 · rule main · triggered by rule Automatic queue on approval for main
  • ⏹️ Testing stopped · in place
  • 🚫 Left the queue 22:41 · c59ef3d

Reason

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

Merge conditions: 2 of 3 met

This pull request

Condition Required by
✅ #review-threads-unresolved = 0 GitHub branch protection
✅ github-review-approved GitHub branch protection

The batch, tested in place

Condition Required by
❌ any of: check-neutral = CI Required, check-skipped = CI Required, check-success = CI Required GitHub branch protection

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

  • Requeue this pull request

Times in UTC · dashboard · how the merge queue works

@XuPeng-SH
XuPeng-SH merged commit 65a1a79 into matrixorigin:main Oct 29, 2026
21 of 22 checks passed
@mergify mergify Bot added dequeued and removed queued labels Oct 29, 2026

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

dequeued kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: mo_ctl flush bad target leaks errno 0 ExpectedEOB

3 participants