Repository navigation
Conversation
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep-reviewed exact head c5dcf40. No blocking issue found.
Correctness/concurrency: COM_STMT_CLOSE state is committed only after the complete packet is forwarded; QUIT seals c2s and joins/pauses s2c before the same backend socket is used for COM_PING. Therefore a successful PING is a valid causal fence, its response cannot be consumed by an old pipe, and no stale packet can reach the next cache generation. All outstanding, fragmented/ambiguous, LOCAL INFILE, and staged-long-data states remain fail-closed.
Unhappy paths/lifecycle: PING error/ERR/EOF/cancellation, pipe quiesce failure, ResetSession failure, and cache rejection all keep the backend unpublished and close it through the existing idempotent owner. The operation is bounded by the existing transfer timeout; close tracking remains capped at 1024 IDs, and the new observability is fixed-cardinality counters rather than per-event logs.
Performance: the extra RTT is restricted to the completed CLOSE-only boundary; clean sessions and CLOSE followed by another acknowledged command pay no fence. This trades one same-socket PING for avoiding a new Proxy-CN TCP/MySQL handshake on every prepared short connection, directly addressing the socket churn/port-exhaustion mechanism.
The production-shaped packet/pipe/tunnel/ResetSession/cache-pop regression covers response isolation and next-generation prepare/execute reuse, with failure/cancel/cache-reject tests; exact-head required CI is green. The 2-CN/2-Proxy long-running campaign remains the appropriate QA/issue-closure gate, not a code-review blocker.
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? |
## 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 #20022 ## What this PR does / why we need it: This follow-up closes the remaining prepared short-connection cache review gaps after PR #27916: - separates QueryService `ResetSession` from MySQL `COM_RESET_CONNECTION`: the Proxy cache reset starts with an empty database, while the client command continues to preserve its selected database; - generates the production-driver shape of a one-parameter binary `COM_STMT_EXECUTE` packet, including iteration-count `1`, null bitmap, new-parameter flag, type, and value, and requires the real Frontend parser to accept it; - sends every one of 100 client generations through the real `connectToBackendContext` cached-login path, including cache authentication, `SET CONNECTION ID`, database restoration, tunnel traffic, `STMT_CLOSE`, `QUIT`, PING fence, ResetSession, cache publication, and the next login; - alternates two login databases and finishes with a login that specifies no database, where `DATABASE()` must return `NULL`; prepared state must be empty before every next client prepares again. Validation: - PR base: `33af6ae3c0c23e4f277137460577ea64678f7ecf` - exact head: `4e3e457b228bde8fcd6641f7d1aca3d546b9d529` - falsification at pre-fix head `2cfed1bb14a3e58de1d8fc5da625d1338e689afc`: FAIL because QueryService ResetSession retained `must_not_leak` - focused Frontend and Proxy regressions: PASS - Proxy 100-generation regression, `count=10`: PASS - focused Frontend and Proxy race regressions: PASS - full `pkg/frontend` and `pkg/proxy`: PASS - full `pkg/frontend -race` and `pkg/proxy -race`: PASS - `go list`, CGo-configured `go build`, `go vet`, and `git diff --check`: PASS - semantic preflight: PASS, diff hash `a98f98d3e9a6175abfe2ec92efab67e06b15abcee9c61e02c2f5c2245eceff95` QA required: yes. These deterministic regressions do not replace the multi-CN, dual-Proxy prepared short-connection campaign required by #20022. BVT: N/A. Ordinary SQL BVT cannot enable Proxy connection caching, generate binary prepared short connections, or assert physical backend reuse across client generations. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…#27916) ## What type of PR is this? - [x] BUG - [ ] API-change - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#20022 ## What this PR does / why we need it: Prepared short connections send `COM_STMT_CLOSE`, which has no response packet. The Proxy previously treated the resulting close tombstone as permanently unsafe at `COM_QUIT`, so the backend was discarded before `ResetSession` and `connCache.Push`; repeated prepared short connections could therefore create unbounded Proxy-to-CN TCP churn and exhaust local ports. This change adds a bounded same-backend `COM_PING` causal fence for the completed close-only boundary. A successful PING proves that the preceding `COM_STMT_CLOSE` reached the CN, after which the existing `ResetSession` and cache publication path may run. Outstanding responses, partial or ambiguous frames, local infile uploads, staged long data, PING errors/EOF/timeouts/cancellation, and cache admission failures remain fail-closed and close the backend exactly once. Fixed low-cardinality counters distinguish fence success, fence failure, and cache publication. No Frontend code, cache limits, public protocol, configuration, or SQL semantics change. ### Validation - Base behavior: **FAIL**. On exact pre-fix main `aa7b969f55e655f3f201fd3337589d070f994494`, the production-shaped prepared-close regression never reached QueryService `ResetSession` (`/tmp/mo-20022-base-latest.log`). - PR-head behavior: **PASS**. Exact head `c5dcf40efd3974cf68e6718b69f6017b3c14ce84` passed the real packet/pipe/tunnel/`connCache.Push`/QueryService reset/`connCache.Pop` regression, including 100 reuse cycles and next-client prepare/execute. - Focused Proxy fence and failure matrix: PASS; focused `-race -count=100`: PASS. - Full `pkg/proxy` CGo tests and package race: PASS. - Frontend ResetSession focused tests: PASS. - `go list -mod=readonly`, CGo-enabled `go build`, CGo-enabled `go vet`, and `git diff --check`: PASS. - Semantic preflight: PASS, exact manifest `/private/tmp/mo-preflight/issue-20022-c5dcf40efd.json`, diff hash `8a0e2885fec53e33b239c6682a71a9829c3a2cb13a36dcb5c8f95cf5d1b4e247`. - BVT: **N/A**. Ordinary SQL BVT cannot enable Proxy connection cache, create binary prepared short connections, or assert backend TCP reuse. The deterministic production-shaped Proxy regression covers the equivalent terminal path. ### QA required **yes**. Re-run the original 2-CN/2-Proxy prepared short-connection campaign with cache enabled, alternating databases, binary prepared point lookups, short connections, and the existing pacing. QA must provide topology, version, full load duration, Proxy/CN login probes, backend/cache publication counts, and terminal results before issue closure or testing-label cleanup. Until then matrixorigin#20022 remains open with `test-verification-failed`. Co-authored-by: XuPeng-SH <[email protected]>
## 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#20022 ## What this PR does / why we need it: This follow-up closes the remaining prepared short-connection cache review gaps after PR matrixorigin#27916: - separates QueryService `ResetSession` from MySQL `COM_RESET_CONNECTION`: the Proxy cache reset starts with an empty database, while the client command continues to preserve its selected database; - generates the production-driver shape of a one-parameter binary `COM_STMT_EXECUTE` packet, including iteration-count `1`, null bitmap, new-parameter flag, type, and value, and requires the real Frontend parser to accept it; - sends every one of 100 client generations through the real `connectToBackendContext` cached-login path, including cache authentication, `SET CONNECTION ID`, database restoration, tunnel traffic, `STMT_CLOSE`, `QUIT`, PING fence, ResetSession, cache publication, and the next login; - alternates two login databases and finishes with a login that specifies no database, where `DATABASE()` must return `NULL`; prepared state must be empty before every next client prepares again. Validation: - PR base: `33af6ae3c0c23e4f277137460577ea64678f7ecf` - exact head: `4e3e457b228bde8fcd6641f7d1aca3d546b9d529` - falsification at pre-fix head `2cfed1bb14a3e58de1d8fc5da625d1338e689afc`: FAIL because QueryService ResetSession retained `must_not_leak` - focused Frontend and Proxy regressions: PASS - Proxy 100-generation regression, `count=10`: PASS - focused Frontend and Proxy race regressions: PASS - full `pkg/frontend` and `pkg/proxy`: PASS - full `pkg/frontend -race` and `pkg/proxy -race`: PASS - `go list`, CGo-configured `go build`, `go vet`, and `git diff --check`: PASS - semantic preflight: PASS, diff hash `a98f98d3e9a6175abfe2ec92efab67e06b15abcee9c61e02c2f5c2245eceff95` QA required: yes. These deterministic regressions do not replace the multi-CN, dual-Proxy prepared short-connection campaign required by matrixorigin#20022. BVT: N/A. Ordinary SQL BVT cannot enable Proxy connection caching, generate binary prepared short connections, or assert physical backend reuse across client generations. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…#27916) ## What type of PR is this? - [x] BUG - [ ] API-change - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#20022 ## What this PR does / why we need it: Prepared short connections send `COM_STMT_CLOSE`, which has no response packet. The Proxy previously treated the resulting close tombstone as permanently unsafe at `COM_QUIT`, so the backend was discarded before `ResetSession` and `connCache.Push`; repeated prepared short connections could therefore create unbounded Proxy-to-CN TCP churn and exhaust local ports. This change adds a bounded same-backend `COM_PING` causal fence for the completed close-only boundary. A successful PING proves that the preceding `COM_STMT_CLOSE` reached the CN, after which the existing `ResetSession` and cache publication path may run. Outstanding responses, partial or ambiguous frames, local infile uploads, staged long data, PING errors/EOF/timeouts/cancellation, and cache admission failures remain fail-closed and close the backend exactly once. Fixed low-cardinality counters distinguish fence success, fence failure, and cache publication. No Frontend code, cache limits, public protocol, configuration, or SQL semantics change. ### Validation - Base behavior: **FAIL**. On exact pre-fix main `aa7b969f55e655f3f201fd3337589d070f994494`, the production-shaped prepared-close regression never reached QueryService `ResetSession` (`/tmp/mo-20022-base-latest.log`). - PR-head behavior: **PASS**. Exact head `c5dcf40efd3974cf68e6718b69f6017b3c14ce84` passed the real packet/pipe/tunnel/`connCache.Push`/QueryService reset/`connCache.Pop` regression, including 100 reuse cycles and next-client prepare/execute. - Focused Proxy fence and failure matrix: PASS; focused `-race -count=100`: PASS. - Full `pkg/proxy` CGo tests and package race: PASS. - Frontend ResetSession focused tests: PASS. - `go list -mod=readonly`, CGo-enabled `go build`, CGo-enabled `go vet`, and `git diff --check`: PASS. - Semantic preflight: PASS, exact manifest `/private/tmp/mo-preflight/issue-20022-c5dcf40efd.json`, diff hash `8a0e2885fec53e33b239c6682a71a9829c3a2cb13a36dcb5c8f95cf5d1b4e247`. - BVT: **N/A**. Ordinary SQL BVT cannot enable Proxy connection cache, create binary prepared short connections, or assert backend TCP reuse. The deterministic production-shaped Proxy regression covers the equivalent terminal path. ### QA required **yes**. Re-run the original 2-CN/2-Proxy prepared short-connection campaign with cache enabled, alternating databases, binary prepared point lookups, short connections, and the existing pacing. QA must provide topology, version, full load duration, Proxy/CN login probes, backend/cache publication counts, and terminal results before issue closure or testing-label cleanup. Until then matrixorigin#20022 remains open with `test-verification-failed`. Co-authored-by: XuPeng-SH <[email protected]>
## 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#20022 ## What this PR does / why we need it: This follow-up closes the remaining prepared short-connection cache review gaps after PR matrixorigin#27916: - separates QueryService `ResetSession` from MySQL `COM_RESET_CONNECTION`: the Proxy cache reset starts with an empty database, while the client command continues to preserve its selected database; - generates the production-driver shape of a one-parameter binary `COM_STMT_EXECUTE` packet, including iteration-count `1`, null bitmap, new-parameter flag, type, and value, and requires the real Frontend parser to accept it; - sends every one of 100 client generations through the real `connectToBackendContext` cached-login path, including cache authentication, `SET CONNECTION ID`, database restoration, tunnel traffic, `STMT_CLOSE`, `QUIT`, PING fence, ResetSession, cache publication, and the next login; - alternates two login databases and finishes with a login that specifies no database, where `DATABASE()` must return `NULL`; prepared state must be empty before every next client prepares again. Validation: - PR base: `33af6ae3c0c23e4f277137460577ea64678f7ecf` - exact head: `4e3e457b228bde8fcd6641f7d1aca3d546b9d529` - falsification at pre-fix head `2cfed1bb14a3e58de1d8fc5da625d1338e689afc`: FAIL because QueryService ResetSession retained `must_not_leak` - focused Frontend and Proxy regressions: PASS - Proxy 100-generation regression, `count=10`: PASS - focused Frontend and Proxy race regressions: PASS - full `pkg/frontend` and `pkg/proxy`: PASS - full `pkg/frontend -race` and `pkg/proxy -race`: PASS - `go list`, CGo-configured `go build`, `go vet`, and `git diff --check`: PASS - semantic preflight: PASS, diff hash `a98f98d3e9a6175abfe2ec92efab67e06b15abcee9c61e02c2f5c2245eceff95` QA required: yes. These deterministic regressions do not replace the multi-CN, dual-Proxy prepared short-connection campaign required by matrixorigin#20022. BVT: N/A. Ordinary SQL BVT cannot enable Proxy connection caching, generate binary prepared short connections, or assert physical backend reuse across client generations. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…#27916) ## What type of PR is this? - [x] BUG - [ ] API-change - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#20022 ## What this PR does / why we need it: Prepared short connections send `COM_STMT_CLOSE`, which has no response packet. The Proxy previously treated the resulting close tombstone as permanently unsafe at `COM_QUIT`, so the backend was discarded before `ResetSession` and `connCache.Push`; repeated prepared short connections could therefore create unbounded Proxy-to-CN TCP churn and exhaust local ports. This change adds a bounded same-backend `COM_PING` causal fence for the completed close-only boundary. A successful PING proves that the preceding `COM_STMT_CLOSE` reached the CN, after which the existing `ResetSession` and cache publication path may run. Outstanding responses, partial or ambiguous frames, local infile uploads, staged long data, PING errors/EOF/timeouts/cancellation, and cache admission failures remain fail-closed and close the backend exactly once. Fixed low-cardinality counters distinguish fence success, fence failure, and cache publication. No Frontend code, cache limits, public protocol, configuration, or SQL semantics change. ### Validation - Base behavior: **FAIL**. On exact pre-fix main `aa7b969f55e655f3f201fd3337589d070f994494`, the production-shaped prepared-close regression never reached QueryService `ResetSession` (`/tmp/mo-20022-base-latest.log`). - PR-head behavior: **PASS**. Exact head `c5dcf40efd3974cf68e6718b69f6017b3c14ce84` passed the real packet/pipe/tunnel/`connCache.Push`/QueryService reset/`connCache.Pop` regression, including 100 reuse cycles and next-client prepare/execute. - Focused Proxy fence and failure matrix: PASS; focused `-race -count=100`: PASS. - Full `pkg/proxy` CGo tests and package race: PASS. - Frontend ResetSession focused tests: PASS. - `go list -mod=readonly`, CGo-enabled `go build`, CGo-enabled `go vet`, and `git diff --check`: PASS. - Semantic preflight: PASS, exact manifest `/private/tmp/mo-preflight/issue-20022-c5dcf40efd.json`, diff hash `8a0e2885fec53e33b239c6682a71a9829c3a2cb13a36dcb5c8f95cf5d1b4e247`. - BVT: **N/A**. Ordinary SQL BVT cannot enable Proxy connection cache, create binary prepared short connections, or assert backend TCP reuse. The deterministic production-shaped Proxy regression covers the equivalent terminal path. ### QA required **yes**. Re-run the original 2-CN/2-Proxy prepared short-connection campaign with cache enabled, alternating databases, binary prepared point lookups, short connections, and the existing pacing. QA must provide topology, version, full load duration, Proxy/CN login probes, backend/cache publication counts, and terminal results before issue closure or testing-label cleanup. Until then matrixorigin#20022 remains open with `test-verification-failed`. Co-authored-by: XuPeng-SH <[email protected]>
## 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#20022 ## What this PR does / why we need it: This follow-up closes the remaining prepared short-connection cache review gaps after PR matrixorigin#27916: - separates QueryService `ResetSession` from MySQL `COM_RESET_CONNECTION`: the Proxy cache reset starts with an empty database, while the client command continues to preserve its selected database; - generates the production-driver shape of a one-parameter binary `COM_STMT_EXECUTE` packet, including iteration-count `1`, null bitmap, new-parameter flag, type, and value, and requires the real Frontend parser to accept it; - sends every one of 100 client generations through the real `connectToBackendContext` cached-login path, including cache authentication, `SET CONNECTION ID`, database restoration, tunnel traffic, `STMT_CLOSE`, `QUIT`, PING fence, ResetSession, cache publication, and the next login; - alternates two login databases and finishes with a login that specifies no database, where `DATABASE()` must return `NULL`; prepared state must be empty before every next client prepares again. Validation: - PR base: `33af6ae3c0c23e4f277137460577ea64678f7ecf` - exact head: `4e3e457b228bde8fcd6641f7d1aca3d546b9d529` - falsification at pre-fix head `2cfed1bb14a3e58de1d8fc5da625d1338e689afc`: FAIL because QueryService ResetSession retained `must_not_leak` - focused Frontend and Proxy regressions: PASS - Proxy 100-generation regression, `count=10`: PASS - focused Frontend and Proxy race regressions: PASS - full `pkg/frontend` and `pkg/proxy`: PASS - full `pkg/frontend -race` and `pkg/proxy -race`: PASS - `go list`, CGo-configured `go build`, `go vet`, and `git diff --check`: PASS - semantic preflight: PASS, diff hash `a98f98d3e9a6175abfe2ec92efab67e06b15abcee9c61e02c2f5c2245eceff95` QA required: yes. These deterministic regressions do not replace the multi-CN, dual-Proxy prepared short-connection campaign required by matrixorigin#20022. BVT: N/A. Ordinary SQL BVT cannot enable Proxy connection caching, generate binary prepared short connections, or assert physical backend reuse across client generations. --------- 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 #20022
What this PR does / why we need it:
Prepared short connections send
COM_STMT_CLOSE, which has no response packet. The Proxy previously treated the resulting close tombstone as permanently unsafe atCOM_QUIT, so the backend was discarded beforeResetSessionandconnCache.Push; repeated prepared short connections could therefore create unbounded Proxy-to-CN TCP churn and exhaust local ports.This change adds a bounded same-backend
COM_PINGcausal fence for the completed close-only boundary. A successful PING proves that the precedingCOM_STMT_CLOSEreached the CN, after which the existingResetSessionand cache publication path may run. Outstanding responses, partial or ambiguous frames, local infile uploads, staged long data, PING errors/EOF/timeouts/cancellation, and cache admission failures remain fail-closed and close the backend exactly once. Fixed low-cardinality counters distinguish fence success, fence failure, and cache publication.No Frontend code, cache limits, public protocol, configuration, or SQL semantics change.
Validation
aa7b969f55e655f3f201fd3337589d070f994494, the production-shaped prepared-close regression never reached QueryServiceResetSession(/tmp/mo-20022-base-latest.log).c5dcf40efd3974cf68e6718b69f6017b3c14ce84passed the real packet/pipe/tunnel/connCache.Push/QueryService reset/connCache.Popregression, including 100 reuse cycles and next-client prepare/execute.-race -count=100: PASS.pkg/proxyCGo tests and package race: PASS.go list -mod=readonly, CGo-enabledgo build, CGo-enabledgo vet, andgit diff --check: PASS./private/tmp/mo-preflight/issue-20022-c5dcf40efd.json, diff hash8a0e2885fec53e33b239c6682a71a9829c3a2cb13a36dcb5c8f95cf5d1b4e247.QA required
yes. Re-run the original 2-CN/2-Proxy prepared short-connection campaign with cache enabled, alternating databases, binary prepared point lookups, short connections, and the existing pacing. QA must provide topology, version, full load duration, Proxy/CN login probes, backend/cache publication counts, and terminal results before issue closure or testing-label cleanup. Until then #20022 remains open with
test-verification-failed.