Skip to content

fix(compile): keep remote receiver stop non-terminal - #28072

Merged
mergify[bot] merged 2 commits into
matrixorigin:mainfrom
jiangxinmeng1:fix/issue-27757-main-context-cancel
Sep 3, 2026
Merged

mergify[bot] merged 2 commits into
matrixorigin:mainfrom
jiangxinmeng1:fix/issue-27757-main-context-cancel

Conversation

@jiangxinmeng1

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

What this PR does / why we need it:

Fix remote pipeline cancellation handling for issue #27757.

This change distinguishes receiver-driven StopSending from actual query or connection cancellation:

  • Treat internal downstream early-stop, such as LIMIT, as successful and allow connection reuse.

  • Keep query cancellation and connection cancellation terminal, returning an error and poisoning the
    connection.

  • Keep substantive remote execution errors terminal.

  • Preserve the first terminal batch-flow classification to avoid cancellation races.

  • Add regression tests covering internal early-stop, query cancellation, connection cancellation, and
    substantive errors.

@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 34f2a28c938caa6831bebb9380f43b20b0dc9a49 against main@ffc8d9f0625c76e87ba967984ce19db2d082b0ba.

I reviewed all three changed files and traced the server handler, pending StopSending tombstone, batch-credit flow, client terminal classification, FIN/ACK reuse boundary, and query/pipeline context normalization. Counterexamples covered receiver stop before and after query cancellation, connection closure, a substantive execution failure, late ACK, and StopSending before lifecycle registration.

The first terminal flow classification is serialized by the existing mutex. A receiver-owned stop can only be suppressed when both external contexts remain active and the recorded cause is cancellation-shaped; message/query cancellation and connection closure are checked first, while substantive MergeRun errors remain terminal. The pending-stop registration race converges through the colexec tombstone plus lifecycle check. Q1 has no new resource owner, Q2 retains the independently cancellable drain/FIN bounds, and Q3 adds no queue or retained-state growth. The extra mutex read occurs only at terminal drain, so there is no material hot-path cost.

The focused regression covers internal stop, external query/connection cancellation, first-terminal-wins, substantive abort, and accounting release. Exact-head MatrixOne UT/SCA/BVT/coverage is green and git diff --check passes. I could not substitute a local focused/race run because this isolated head has no matching CGo artifact and the primary worktree native inputs differ; the exact-head CI evidence remains valid for the normal package/build paths.

No blocking correctness, liveness, resource, compatibility, or performance issue found.

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

mergify Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-03 10:32 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-09-03 10:33 UTC · at 3dfa60764920c1f6fb9d94470d12f42ac2448488 · squash

This pull request spent 33 seconds in the queue, including 3 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 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
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)

@mergify
mergify Bot merged commit 3dfa607 into matrixorigin:main Sep 3, 2026
27 of 28 checks passed
@mergify mergify Bot removed the queued label Sep 3, 2026
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
)

Fix remote pipeline cancellation handling for issue matrixorigin#27757.

This change distinguishes receiver-driven StopSending from actual query or connection cancellation:

- Treat internal downstream early-stop, such as LIMIT, as successful and allow connection reuse.
- Keep query cancellation and connection cancellation terminal, returning an error and poisoning the
connection.

- Keep substantive remote execution errors terminal.
- Preserve the first terminal batch-flow classification to avoid cancellation races.
- Add regression tests covering internal early-stop, query cancellation, connection cancellation, and
substantive errors.

Approved by: @XuPeng-SH
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
)

Fix remote pipeline cancellation handling for issue matrixorigin#27757.

This change distinguishes receiver-driven StopSending from actual query or connection cancellation:

- Treat internal downstream early-stop, such as LIMIT, as successful and allow connection reuse.
- Keep query cancellation and connection cancellation terminal, returning an error and poisoning the
connection.

- Keep substantive remote execution errors terminal.
- Preserve the first terminal batch-flow classification to avoid cancellation races.
- Add regression tests covering internal early-stop, query cancellation, connection cancellation, and
substantive errors.

Approved by: @XuPeng-SH
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
)

Fix remote pipeline cancellation handling for issue matrixorigin#27757.

This change distinguishes receiver-driven StopSending from actual query or connection cancellation:

- Treat internal downstream early-stop, such as LIMIT, as successful and allow connection reuse.
- Keep query cancellation and connection cancellation terminal, returning an error and poisoning the
connection.

- Keep substantive remote execution errors terminal.
- Preserve the first terminal batch-flow classification to avoid cancellation races.
- Add regression tests covering internal early-stop, query cancellation, connection cancellation, and
substantive errors.

Approved by: @XuPeng-SH

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

3 participants