Repository navigation
Conversation
…6782) ## 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#26779 ## What this PR does / why we need it: Adds a shared `ctl.GetFirstTNResponse` boundary for callers that require a TN response. When no TN is available, table statistics, `SHOW ACCOUNTS` storage usage, and `mo_ctl(..., INSPECT, ...)` now return `ErrNoAvailableBackend` instead of indexing an empty result and panicking the CN. Commands where an empty target set is valid continue to consume `Result.Data` directly. Adds regression coverage for the shared boundary, table statistics, and `SHOW ACCOUNTS`. --------- Co-authored-by: XuPeng-SH <[email protected]>
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review of head fbee825.
This is an exact semantic backport of the merged main fix c72224b: both diffs have the same stable patch-id. The empty-target invariant is closed for every strict first-response consumer on 4.2-dev: table stats, SHOW ACCOUNTS storage usage, and mo_ctl INSPECT now return ErrNoAvailableBackend through GetFirstTNResponse. The remaining snapshot-read consumer already handles an empty target set explicitly as a valid unsuccessful response.
I also traced TN disappearance after enumeration. Send, stream creation, and receive failures return errors; successful sends preserve response cardinality, including cached-write response trimming, so the same panic is not left behind in a short-response path.
No correctness, compatibility, resource-lifecycle, hang, or performance blocker found. The normal-path cost is one type assertion and one length check, with no extra RPC, retry, allocation growth, lock, or scan.
Validation:
- focused empty-TN regressions for ctl, frontend, and disttae passed under -race
- full tests for all three changed packages passed
- go list, go build, and go vet for all three changed packages passed
- git diff --check passed
What type of PR is this?
Which issue(s) this PR fixes:
issue #26779
What this PR does / why we need it:
Backports #26782 (
c72224bea6) to4.2-dev.Adds a shared
ctl.GetFirstTNResponseboundary for callers that require a TN response. When no TN is available, table statistics,SHOW ACCOUNTSstorage usage, andmo_ctl(..., INSPECT, ...)now returnErrNoAvailableBackendinstead of indexing an empty result and panicking the CN. Commands where an empty target set is valid continue to consumeResult.Datadirectly.The original regression tests are included unchanged.
Testing
go test -mod=readonly -count=1 -timeout 180s ./pkg/sql/plan/function/ctl ./pkg/frontend ./pkg/vm/engine/disttae