Clarifying resource group token distribution behavior
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 783
- Avg merge
- 5d 21h
- Merged PRs (30d)
- 36
Description
I'm currently in the process of root causing why our TiDB host fleet sees RG exceeded errors for resource groups with < 50% avg utilization / < 75% max utilization. I'm looking to clarify [this](https://github.com/tikv/pd/blob/640fbed566acac2e26db2b832b68c8d41a35d1e1/client/resource_group/controller/controller.go#L1257) part of the token allocation logic:
```
// Otherwise the granted token is delivered to the client by fill rate.
cfg.NewTokens = 0
trickleDuration := time.Duration(trickleTimeMs) * time.Millisecond
deadline := gc.run.now.Add(trickleDuration)
cfg.NewRate = float64(bucket.GetSettings().FillRate) + granted/trickleDuration.Seconds()
```
AFAICT, we should set NewTokens to the granted value here as well, instead of updating the FillRate. Can someone confirm the code really reflects the intended behavior?
Contributor guide
Assessment
This issue has not been assessed yet.