resource_group client: narrow degraded fallback conditions for GetResourceGroup
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 783
- Avg merge
- 5d 21h
- Merged PRs (30d)
- 36
Description
## Enhancement Task
As suggested in PR comment: https://github.com/pingcap/tidb/pull/68105#discussion_r3584191593
Refine the degraded fallback behavior of `GetResourceGroup` when `degradedRUSettings` is configured.
Currently, degraded fallback is too broad and may hide original errors from RM. We should only use degraded fallback for transient RM failures, while preserving original errors for non-retryable cases.
Expected behavior:
- transient RM unavailability -> degraded group
- RM recovery -> real group
- resource group not found -> original error
- caller cancellation/deadline -> original context error
- generic non-retryable error -> original error
- nonexistent `SwitchGroup` target -> do not switch
It is also helpful to preserve the underlying error from `ErrClientGetResourceGroup` so upper layers can correctly inspect errors such as `context.Canceled` and `context.DeadlineExceeded`.
Contributor guide
Research direction
Start by tracing the GetResourceGroup path and how degradedRUSettings is applied, then inspect ErrClientGetResourceGroup and SwitchGroup handling. Verify each listed outcome: transient RM failures use the degraded group, recovery uses the real group, and not-found, context, generic non-retryable, and nonexistent-target cases preserve the original behavior and errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100