test: fix data race in resouce control interceptor initialization (#44789)

close pingcap/tidb#44776
This commit is contained in:
glorv
2023-06-19 18:37:10 +08:00
committed by GitHub
parent b5dbe69522
commit 802f7fdce8
2 changed files with 1 additions and 1 deletions

View File

@ -1382,6 +1382,7 @@ func (do *Domain) initResourceGroupsController(ctx context.Context, pdClient pd.
serverAddr := net.JoinHostPort(serverInfo.IP, strconv.Itoa(int(serverInfo.Port)))
do.runawayManager = resourcegroup.NewRunawayManager(control, serverAddr)
do.resourceGroupsController = control
tikv.SetResourceControlInterceptor(control)
return nil
}

View File

@ -238,7 +238,6 @@ func main() {
resourcemanager.InstanceResourceManager.Start()
storage, dom := createStoreAndDomain(keyspaceName)
svr := createServer(storage, dom)
tikv.SetResourceControlInterceptor(dom.ResourceGroupsController())
// Register error API is not thread-safe, the caller MUST NOT register errors after initialization.
// To prevent misuse, set a flag to indicate that register new error will panic immediately.