From 802f7fdce8d2f84bd2188d19263a1ee7ee93b5fb Mon Sep 17 00:00:00 2001 From: glorv Date: Mon, 19 Jun 2023 18:37:10 +0800 Subject: [PATCH] test: fix data race in resouce control interceptor initialization (#44789) close pingcap/tidb#44776 --- domain/domain.go | 1 + tidb-server/main.go | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/domain/domain.go b/domain/domain.go index d00fb08fd8..116ae67324 100644 --- a/domain/domain.go +++ b/domain/domain.go @@ -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 } diff --git a/tidb-server/main.go b/tidb-server/main.go index cb5e30e62e..48456c371e 100644 --- a/tidb-server/main.go +++ b/tidb-server/main.go @@ -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.