Skip to content

fix(frontend): preserve cancellation errors during LOCAL uploads - #33053

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/fix-load-local-cancel-error
Nov 22, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/fix-load-local-cancel-error

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • BUG
  • Test and CI

Which issue(s) this PR fixes:

Related to #31475 and #31703. The failing coverage test was observed on #32914.

What this PR does / why we need it:

When KILL QUERY interrupted a LOAD DATA LOCAL upload, closing the pipe reader caused the SQL consumer to see io.ErrClosedPipe. The client could receive MySQL error 1105 for the interrupted query.

Close the upload pipe writer with the cancellation error so the consumer receives it and the existing protocol mapping returns MySQL error 1317 / SQLSTATE 70100. The upload owner still drains a finite client stream before the session is reused. The regression captures the consumer error while the finite tail is pending and checks it after the upload owner has joined.

Validation

  • The deterministic pipe regression returned io.ErrClosedPipe on clean main at 96d0d01872.
  • The full frontend package passed with the race detector in short mode. All seven TestKillLoadLocal wire scenarios passed under race and 12 times each with coverage enabled.
  • The focused pipe regression and the partial-payload wire scenario also passed 100 race repetitions each on the identical fix.
  • Formatting, diff checks, err-check, vet, golangci-lint and molint passed for the affected scope.

Close the producer end of the upload pipe with the cancellation error. This wakes both endpoints and delivers the existing query-interruption error to the statement consumer while the upload owner drains the connection.

Signed-off-by: XuPeng-SH <[email protected]>
@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 →

@mergify

mergify Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH

XuPeng-SH commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 36acb9b898ddd8199625a337414fd87b317905ae

"interrupted"

@XuPeng-SH

XuPeng-SH commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 969ad088725aba963d9f18f46a6e48b1ea3e97a3

Review completed. Read the assessment.

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

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

Commit: 969ad088725aba963d9f18f46a6e48b1ea3e97a3

Assessment: approve

Closing the upload pipe writer delivers cancellation to the SQL reader. The existing error mapping returns MySQL 1317, and the upload owner drains the finite client stream before the connection is reused. The wire tests verified rollback and session reuse.

Model: gpt-6.2-sol / xhigh

Session: 01a1f0a0-5126-78f3-9ab8-ef4e87f2f119 · slot 0 · generation 3

Validation:

  • The target-base control reproduced io.ErrClosedPipe at the new regression assertion. See frontend-drain-base-control.jsonl and checks/1795320251180987094-2.json.

  • Focused frontend tests and all seven one-CN TestKillLoadLocal wire scenarios passed with race detection and coverage. See focused-race-cover.jsonl and checks/1795320271954009620-2.json.

  • The frontend cancellation regression passed 30 repetitions, and the partial-payload wire case passed 16 repetitions, with race detection and coverage. See checks/1795320326945862187-2.json and checks/1795320345062280563-2.json.

  • The frontend package passed in short mode with race detection and coverage. See frontend-package-race-cover.jsonl and checks/1795320361589481582-2.json.

Limitations:

  • The frontend package run excluded Test_openNewFile_nilCtx because that fixture writes inside the read-only checkout. Short mode also skipped TestRuleCacheDoubleCheckLocking.

@XuPeng-SH
XuPeng-SH merged commit a77c55b into matrixorigin:main Nov 22, 2026
@XuPeng-SH
XuPeng-SH deleted the codex/fix-load-local-cancel-error branch November 22, 2026 04:08

This branch was successfully deployed

No deployments
ci — 969ad088 Deployed Nov 22, 2026 by mergify[bot]
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/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants