Repository navigation
fix(frontend): preserve LOCAL upload framing on KILL QUERY - #31703
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 276763b2c99662370cec9fe0a35be9ad7f19acf8
Assessment: approve
The fix preserves interrupted LOCAL packet framing while retaining bounded draining, fatal-error retirement and watcher synchronization. Regression tests cover connection reuse, rollback and relevant failure paths. No actionable findings remain.
Model: gpt-6-astra / xhigh
Session: 01a1869d-999c-7481-b340-ae4a63e8cee4 · slot 1 · generation 2
Validation:
-
Reviewed the complete delta, both linked issues, all discussion entries, and affected protocol, cancellation and transaction owners.
-
Local scope, clean-source, patch, gofmt and whitespace checks passed; retained static-check.log and receipt checks/1793274081409919317-2.json.
-
Reused supplied successful Linux UT, arm64 SCA and both BVT-group results, supported by the author's reported frontend normal/race and SQL integration validation.
-
Saved review-plan.md and discussion-assessment.json.
Limitations:
-
No local Go or SQL tests were rerun. Raw author and CI test logs were not supplied; execution results remain attributed to the supplied evidence.
-
Connection preservation remains subject to the existing drain timeout and byte limits.
🚫 Left the queue58 min in the queue, with no time running CI. So far
Reason Pull request #31703 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.
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. Tick the box to put this pull request back in the merge queue (same as
Times in UTC · dashboard · how the merge queue works |
) ## What type of PR is this? - [x] BUG - [x] 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. Signed-off-by: XuPeng-SH <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #31475 (includes the active-session KILL coverage consolidated from #31278).
What this PR does / why we need it:
KILL QUERYduring a finiteLOAD DATA LOCALupload could still disconnect the client after #31300: a socket interrupt discarded partial packet progress, so the drain could not safely find the actual upload EOF. Preserve header/payload progress under the upload owner's control and discard exactly the interrupted frame before draining subsequent packets. The client receives 1317/70100, the LOAD statement rolls back, and the original connection remains usable.The discard path keeps the existing silent-read, total-time and byte limits, checks the remaining packet against its byte budget before reading or allocating, and uses at most 32 KiB of new reusable scratch. Fatal framing/transport errors and stalled or over-budget streams still retire the connection. Bytes inside a payload cannot masquerade as upload EOF or commands. The cancellation watcher remains joined before deadline clearing and connection reuse.
Extend the existing lightweight protocol fixture and shared one-CN SQL integration fixture. Deterministic barriers exercise cancellation after a complete header and after LOAD execution but before transaction finalization. Tests assert exact 1317/70100, rollback, unchanged connection ID across successive LOAD cancellations, preservation of the prior statement in an explicit transaction, KILL CONNECTION behavior, successful completed LOAD/idle KILL, and ordinary SLEEP cancellation. Existing malformed-tail, timeout, byte-bound and cleanup oracles are retained.
Validation
./pkg/frontendnormal and race runs pass using.agents/skills/mo-dev/scripts/mo-cgo-test../pkg/tests/sqlintegrationnormal run passes; the correctedTestKillLoadLocalroot also passes after the review's explicit-transaction barrier correction.gofmt,git diff --check,go vetand incrementalgolangci-lintpass for the changed package closure.CI repair validation — 276763b
The Linux/arm64 SCA failure, attempt 1 was reproduced with CI-pinned molint
35bd4d9a4055:DiscardLoadLocalPacketintroduced an unapprovedrecover. Route the synchronous discard through the existing approvedExecuteFuncWithRecover; errors and panics still invalidate framing and prevent further drain/read reuse. No analyzer suppression or tool-version change.New validation on darwin/arm64, Go 1.27.1:
.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s ./pkg/frontendand the same command with-race: both pass.TestProcessLoadLocalResumesInterruptedFramealso passes 100 adaptive race repetitions after one measured run.molint check -mod=readonly ./pkg/frontend ./pkg/tests/sqlintegration,go vetfor the same packages, incrementalgolangci-lint(0 issues), gofmt, diff checks and the delivery artifact check pass.The unchanged SQL integration evidence above is reused; this correction changes only the panic recovery boundary. The full Linux SCA result remains pending new CI.
All results above are local darwin/arm64, Go 1.27.1 evidence. GitHub CI is pending.
Scope
The historical unknown-ID and silent-success variants did not reproduce when KILL targeted a known active session at synchronized upload/finalization boundaries on current main. The regression test explicitly rejects both outcomes; no speculative connection-map, routing or transaction rewrite is included. Multi-CN routing is unchanged. Connection reuse remains bounded by the existing upload-drain limits.