Repository navigation
fix(frontend): keep connections alive after long-running requests - #27156
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? |
aptend
left a comment
There was a problem hiding this comment.
Reviewed the connection lifecycle and cancellation paths at exact head fa8252c. The change correctly distinguishes the routine/root cancellation state from the retired request observer timeout, while preserving explicit KILL CONNECTION, disconnect cleanup, request cancellation, rollback, and protocol-close behavior. The explain node-name additions are complete for the currently supported enum values.
Focused frontend lifecycle tests and exhaustive explain name/title/label coverage pass with the required CGO/thirdparties setup.
Non-blocking metadata note: the PR body links #26720, but that issue describes the IVF pre-filter OOM rather than the long-request connection timeout; please correct the issue association when convenient.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep-reviewed exact head fa8252c. No blocking issues found.
The root-cause fix is sound: the former 30-minute child context never governed SQL execution, so it could not interrupt a hung query; it only caused rollback/connection close after a successful request exceeded the observer threshold. Query cancellation remains owned by SessionTimeout, KILL QUERY, KILL CONNECTION, and disconnect cleanup. The explain-name additions are complete and consistent with the existing title/label handlers.
Validated locally with go list/build/vet for both affected packages, focused frontend/explain tests, frontend lifecycle race tests, and full package tests.
Non-blocking metadata note: #26720 describes a ~21-second IVF concurrency OOM and was fixed by #26989, so it is not the issue this PR fixes. Please replace that reference with the actual long-request connection issue before merge. CI was still running when this review was submitted.
Merge Queue Status
This pull request spent 17 minutes 11 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #27156 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.
Failing checks:
HintYou 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
|
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue #26720 ## What this PR does / why we need it: Backport the fixes missing from `4.2-dev` for [#26720](#26720) and [#25114](#25114). Included PRs: - #26711: Fix pipeline remote batch backpressure - #26739: Retry COS multipart initialization on EOF - #26759: Fix IVF prefilter OOM - #26989: Reduce IVF prefilter scan memory copies - #27156: Keep connections alive after long-running requests The changes address vector-index memory usage, file-service retry behavior, remote pipeline backpressure, and frontend connection lifecycle on `4.2-dev`. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: XuPeng-SH <[email protected]>
…trixorigin#27156) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26720 ## What this PR does / why we need it: ## Summary Fix frontend connections being incorrectly closed after a successful long-running request. `Routine.handleRequest` created a request observer context with a fixed 30-minute deadline and later treated expiration of that child context as cancellation of the connection itself. As a result, SQL requests running longer than 30 minutes could complete successfully but still trigger transaction rollback and connection closure, causing clients to report `Lost connection to MySQL server during query`. This PR: - determines connection termination only from the real routine/root context or explicit connection cancellation; - removes the obsolete per-request observer deadline; - preserves client disconnect, `KILL CONNECTION`, cancellation, rollback, and cleanup behavior; - adds a regression test proving that expiration of a request-scoped child context does not close a healthy connection; - completes explain node-name coverage for `APPLY`, `POSTDML`, and `TABLE_CLONE`, preventing long- query plan diagnostics from reporting `Unsupported node type`. ## Validation - `TestRoutineShouldCloseConnectionIgnoresRequestDeadline` passed. - `TestGetLabelOrTitle` passed with exhaustive node-type name coverage. - Nightly IVF workflow validation used a temporary 10-minute observer deadline: - `LOAD DATA` ran for `28m52s`; - no `rollback the txn`, lost connection, or request failure occurred; - the workflow successfully continued into IVFFlat index construction. Validation workflow: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/31778171059/job/94700724247 --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…trixorigin#27156) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26720 ## What this PR does / why we need it: ## Summary Fix frontend connections being incorrectly closed after a successful long-running request. `Routine.handleRequest` created a request observer context with a fixed 30-minute deadline and later treated expiration of that child context as cancellation of the connection itself. As a result, SQL requests running longer than 30 minutes could complete successfully but still trigger transaction rollback and connection closure, causing clients to report `Lost connection to MySQL server during query`. This PR: - determines connection termination only from the real routine/root context or explicit connection cancellation; - removes the obsolete per-request observer deadline; - preserves client disconnect, `KILL CONNECTION`, cancellation, rollback, and cleanup behavior; - adds a regression test proving that expiration of a request-scoped child context does not close a healthy connection; - completes explain node-name coverage for `APPLY`, `POSTDML`, and `TABLE_CLONE`, preventing long- query plan diagnostics from reporting `Unsupported node type`. ## Validation - `TestRoutineShouldCloseConnectionIgnoresRequestDeadline` passed. - `TestGetLabelOrTitle` passed with exhaustive node-type name coverage. - Nightly IVF workflow validation used a temporary 10-minute observer deadline: - `LOAD DATA` ran for `28m52s`; - no `rollback the txn`, lost connection, or request failure occurred; - the workflow successfully continued into IVFFlat index construction. Validation workflow: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/31778171059/job/94700724247 --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…trixorigin#27156) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26720 ## What this PR does / why we need it: ## Summary Fix frontend connections being incorrectly closed after a successful long-running request. `Routine.handleRequest` created a request observer context with a fixed 30-minute deadline and later treated expiration of that child context as cancellation of the connection itself. As a result, SQL requests running longer than 30 minutes could complete successfully but still trigger transaction rollback and connection closure, causing clients to report `Lost connection to MySQL server during query`. This PR: - determines connection termination only from the real routine/root context or explicit connection cancellation; - removes the obsolete per-request observer deadline; - preserves client disconnect, `KILL CONNECTION`, cancellation, rollback, and cleanup behavior; - adds a regression test proving that expiration of a request-scoped child context does not close a healthy connection; - completes explain node-name coverage for `APPLY`, `POSTDML`, and `TABLE_CLONE`, preventing long- query plan diagnostics from reporting `Unsupported node type`. ## Validation - `TestRoutineShouldCloseConnectionIgnoresRequestDeadline` passed. - `TestGetLabelOrTitle` passed with exhaustive node-type name coverage. - Nightly IVF workflow validation used a temporary 10-minute observer deadline: - `LOAD DATA` ran for `28m52s`; - no `rollback the txn`, lost connection, or request failure occurred; - the workflow successfully continued into IVFFlat index construction. Validation workflow: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/31778171059/job/94700724247 --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
issue #26720
What this PR does / why we need it:
Summary
Fix frontend connections being incorrectly closed after a successful long-running request.
Routine.handleRequestcreated a request observer context with a fixed 30-minute deadline and latertreated expiration of that child context as cancellation of the connection itself. As a result, SQL
requests running longer than 30 minutes could complete successfully but still trigger transaction
rollback and connection closure, causing clients to report
Lost connection to MySQL server during query.This PR:
cancellation;
KILL CONNECTION, cancellation, rollback, and cleanup behavior;healthy connection;
APPLY,POSTDML, andTABLE_CLONE, preventing long-query plan diagnostics from reporting
Unsupported node type.Validation
TestRoutineShouldCloseConnectionIgnoresRequestDeadlinepassed.TestGetLabelOrTitlepassed with exhaustive node-type name coverage.LOAD DATAran for28m52s;rollback the txn, lost connection, or request failure occurred;Validation workflow:
https://github.com/matrixorigin/mo-nightly-regression/actions/runs/31778171059/job/94700724247