Skip to content

fix(frontend): preserve KILL QUERY interruption identity - #29794

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
XuPeng-SH:fix/29693-kill-query-error
Oct 9, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
XuPeng-SH:fix/29693-kill-query-error

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Oct 9, 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 #29693.

What this PR does / why we need it:

KILL QUERY can reach the shared MySQL ERR response boundary as raw context cancellation after remote execution. This previously returned 1105/HY000 instead of query-interrupted 1317/70100 for both COM_QUERY and COM_STMT_EXECUTE.

Normalize pure cancellation error trees at the existing response owner. Mixed error trees retain substantive errors; custom As identities, deadline mappings, original error text and server-shutdown precedence remain intact. No successful-query execution path, retry state or pipeline cleanup ownership changes.

Reuse the existing three-CN cancellation fixture to assert the public error identity, remote sender/stream cleanup, and reuse of the same physical connection and prepared statement after cancellation. Add 26 wire-level error cases for each command, including wrapped/joined cancellation, mixed failures, deadlines and actual JoinMap error wrappers.

The inline RPC shutdown test also previously closed and rebooted the process-wide ants pool to force submission failure. CI exposed a race between reboot and a retiring worker. Use a private submission helper and an already-closed, test-owned pool through the existing RPC callback registration instead. This preserves real rejection and inline drain/cancellation coverage without changing global pool state or adding per-server scheduling state. The third-party pool restart implementation is outside this correction.

Validation

  • Reproduced 1105 instead of 1317 on the base in both wire tests and real three-CN text/binary KILL QUERY.
  • Final protocol response tests: PASS.
  • Full frontend normal tests and final full frontend UT with -race: PASS.
  • Three-CN public cancellation/reuse test normal and final -race: PASS.
  • Concurrent session-close test with -race -count=100: PASS.
  • Incremental SCA for pkg/frontend and pkg/tests/issues/isolated: go vet PASS; repository-configured golangci-lint reports 0 issues; molint exits 0 with seven existing warnings in files unchanged from base.
  • MORPC inline/async/mixed/sync shutdown test: -race -count=100 PASS; full MORPC normal and -race PASS.
  • Incremental MORPC SCA: go vet, repository molint and configured golangci-lint PASS, no new findings.
  • Final shared MORPC dependency: frontend and three-CN public cancellation/reuse -race revalidated.
  • git diff --check: PASS. Go 1.27.1; repository CGo prerequisites rebuilt locally.
  • Design and independent final QA review: gpt-6.1-sol xhigh, APPROVE.

Changes affect failed responses only; no successful-query performance improvement or CI success is claimed from these local checks.

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

Choose a reason for hiding this comment

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

Commit review for 8884b80: no blocking findings. The shared MySQL ERR response boundary is the appropriate owner for cancellation identity. Mixed substantive failures, deadlines, JoinMap As identity, shutdown precedence, original message text, and teardown lock order remain preserved. Wire and three-CN text/prepared tests cover public identity, remote cleanup, and connection/statement reuse. Local focused tests, race, and incremental SCA pass. Required CI checks are still running; this comment does not claim CI completion. GitHub does not allow the PR author to approve their own PR, so this is submitted as a comment review.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Commit review for 137e9fa: no blocking findings. Cancellation identity is normalized at the shared MySQL ERR response boundary; mixed substantive errors, deadlines, JoinMap As identity, shutdown precedence, and original error text are preserved. RPC rejection coverage now uses a private closed pool and leaves the shared ants lifecycle untouched. Race CI, the three-CN text/prepared cancellation and reuse test, SCA, and required CI pass. Connector/J E2E could not start because Maven download failed; this is not counted as a product-test pass.

@XuPeng-SH
XuPeng-SH merged commit f5268b1 into matrixorigin:main Oct 9, 2026
@XuPeng-SH
XuPeng-SH deleted the fix/29693-kill-query-error branch October 9, 2026 17:34
XuPeng-SH added a commit that referenced this pull request Oct 10, 2026
)

Opt-in embedded MO-reader queries now lower MO exact Decimal64/128/256
values and descriptors to Sirius GPU execution. One immutable
capability-scoped profile owns admission, physical types/literals, bound
scalar/aggregate overloads, input publication, result reconstruction and
public numeric error classes. Terminal evidence records verified
descriptors and a schema digest without logging headings or values.

This implements approved PR C from #29690 and the versioned
[design/validation
map](https://github.com/matrixorigin/matrixone/blob/a4e34ef05de6a6d02ceb0fa81219cacd452ae6c8/docs/design/sirius-mo-exact-lowering.md).
Physical width is preserved at narrow declared precision; MO-bound
division metadata and 32-byte Decimal256 coefficients use the existing
credit-before-copy and borrowed-result contracts. Embedded fetch
defaults and DATE extraction use supported native wire forms.

All prerequisites are merged and inherited:

- Sirius [#29](matrixorigin/sirius#29):
`908ffc75a58b3be496b2172795e416326416e7ec`, with merged importer #5 at
`99c7ca3b6f8f3159239e119ed2982d42f98c4690`.
- Kernel [#29775](#29775):
`af3f7232a31879a2d6ed590785c8e9a560361c3f`. Prepared SELECT metadata
comes from the executed generation; incomplete saved SELECTs clear
session state before reuse.
- Main [#29794](#29794)
supplies the existing MORPC shutdown-test race correction. Main now also
includes the histogram-export synchronization fix; C uses main's bounded
two-send notification wait unchanged.

Final release/native integration at executable C head `ad61b5b5d3`, on
merged-kernel main `af3f7232a3`, passes:

- Default, Sirius-only and combined Sirius/cuVS release builds. The
clean merged SDK, all 73 fingerprints, compiler/header/proto identity
and runtime package/provenance guards pass.
- All 22 native preparations without reader/GPU-task admission. The
complete public MySQL numeric fixture passes exact values,
metadata/NULLs, arithmetic/aggregates/joins/sort, operation-owned
errors, masked errors, healthy reuse and prepared division increments
0/4/10/30/4. Native MO supplies the independent oracle.
- All 31 public terminal events show capability 31,
`mo-exact-decimal-v1`, completed GPU tasks, no fallback, healthy cleanup
and zero retained input/result credit.
- Four C-owning packages plus frontend pass default normal/race checks;
native-tag owning checks and the complete combined bridge suite pass.
cuVS-before/Sirius/cuVS-after passes in one process.
- All nine public prepared-metadata/saved-result cases pass normal mode
and three race repetitions, including a real persisted-batch failure
followed by successful save/replay on the same physical connection.
- Native data/cancellation passes 68 race repetitions in one process
(measured 0.44s; 30s budget). The exact MORPC shutdown test passes 100
race repetitions. Metrics focused/owning normal/race and 100 focused
race repetitions pass.

The delivered head is `b34111b4c9e94cda034d199a2c362072fe98d808`,
normally merged with authoritative main
`e5dd4724f782067e1c76c38c9d2f55cebceda4a9`. Review fixes are committed
in `af4f342066`: typed DATE lowering preserves persisted MO zero dates;
exact CASE retains the MO-bound descriptor around IfThen; ordinary
embedded integer add/subtract/multiply declines before readers because
the pinned consumer does not implement MO checked overflow. Flight
encoding/admission, reader bytes, native ABI and the merged Sirius pin
are unchanged.

The installed and loaded host drivers now both report NVIDIA 615.78.08;
final GPU checks run directly with the installed driver. The bounded
local native fixture uses 256 MiB GPU and 2 GiB host capacity. An
initial 512 MiB host fixture correctly rejected larger progress-window
reservations; only the test fixture was corrected. Production windows,
limits and assertions remain unchanged.

Review-resolution validation at prior head `a4e34ef05d`:

- Both incoming counterexamples have real GPU red/green proof. Zero DATE
now returns 0/0/0 alongside year-0001/leap-day/year-9999/NULL controls,
with SQL mode restored. Nullable division conditions with two required
decimal arms execute with native-MO values and nullable DECIMAL(15,2)
metadata.
- The existing public fixture covers integer +/-/* overflow declines and
healthy integral/decimal reuse. No new cluster, production hook, native
library dependency, sleep or skip was added.
- All 22 native preparations pass. Full public GPU normal mode passes
(9.596s); measured race mode followed by three in-process repetitions
passes (29.571s). Its 34 terminal events verify exact
profile/capability31, completed GPU work, no fallback, healthy cleanup
and zero retained input/result credits.
- Fresh combined release/native provenance and full bridge/coexistence
pass. Exporter/compiler/CN owning normal/race, focused new wire/domain
regressions, config and full mandatory pre-push SCA pass with zero lint
findings. Self-review has no unresolved implementation blocker.

**Ready for review; merge gates remain required CI and reviewer
approval.** Both incoming findings were reproduced on actual GPU/public
MySQL and fixed with regressions. A separate admitted integer-overflow
counterexample returned -2 instead of native MO 1690/22003; it now
declines before execution. Fresh CI is pending for the delivered head,
and the reviewer has been asked to reassess the fixes. Local passes do
not establish required CI success.

C remains opt-in. D begins after C merges and stays one complete public
campaign PR for all-22 SF1/SF10, bounded comparison,
lifecycle/resource/process evidence and performance gates. E/F retain
their separate recovery-readiness design. References #28968 and #28966;
neither issue is closed by C.


Conflict resolution at `b34111b4c9` (2026-10-10): normally merged
authoritative main `e5dd4724f7`. The single conflict was two equivalent
asynchronous histogram-test fixes; main's stopped-timer notification
barrier is retained unchanged. All 28 prior C paths were checked: only
this test changed, while the DATE/CASE/integer review fixes and merged
native pins remain intact.

Validation at this merged head passes: affected owning packages
normal/race, 100 focused metrics race repetitions, fresh native
generations and combined release/package, all 22 actual preparations
(1.116s), full public GPU normal/race (9.762s/11.999s), and full
combined bridge/coexistence (1.108s). Both public runs' 34 terminal
events verify completed GPU work, exact profile/capability31, healthy
cleanup, no fallback and zero retained credits. Mandatory pre-push SCA
passes with zero findings; self-review has no unresolved implementation
blocker. New-head required CI and human reviewer approval remain the
merge gates.

---------

Co-authored-by: XuPeng-SH <[email protected]>

This branch was previously deployed

1 inactive deployment
ci — 7ed194b3 Deployed Oct 9, 2026 by XuPeng-SH
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/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: multi-CN KILL QUERY returns 1105/HY000 instead of 1317/70100

2 participants