Skip to content

Commit

Permalink
resource_control: fix data race in controller (#7520)
Browse files Browse the repository at this point in the history
close #4399, ref pingcap/tidb#49311

the meta information is not safe to visit concurrency
- address the data race condition

Signed-off-by: Shuning Chen <nolouch@ShuningdeMacBook-Pro.local>

Co-authored-by: Shuning Chen <nolouch@ShuningdeMacBook-Pro.local>
  • Loading branch information
nolouch and Shuning Chen authored Dec 11, 2023
1 parent ab68192 commit fcdeec4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion client/resource_group/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,7 @@ func (gc *groupCostController) onRequestWait(
*gc.mu.storeCounter[info.StoreID()] = *gc.mu.globalCounter
gc.mu.Unlock()

return delta, penalty, waitDuration, gc.meta.Priority, nil
return delta, penalty, waitDuration, gc.getMeta().GetPriority(), nil
}

func (gc *groupCostController) onResponse(
Expand Down
1 change: 1 addition & 0 deletions client/resource_group/controller/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func init() {
prometheus.MustRegister(resourceGroupStatusGauge)
prometheus.MustRegister(successfulRequestDuration)
prometheus.MustRegister(failedRequestCounter)
prometheus.MustRegister(failedLimitReserveDuration)
prometheus.MustRegister(requestRetryCounter)
prometheus.MustRegister(tokenRequestDuration)
prometheus.MustRegister(resourceGroupTokenRequestCounter)
Expand Down

0 comments on commit fcdeec4

Please sign in to comment.