From d3554347ae0ddb84d71002b90df55942240e7445 Mon Sep 17 00:00:00 2001 From: zyguan Date: Mon, 13 Jan 2025 11:36:19 +0800 Subject: [PATCH] region_cache: fix a potential data race on store.addr (#1545) close tikv/client-go#1544 Signed-off-by: zyguan --- internal/locate/region_cache.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/locate/region_cache.go b/internal/locate/region_cache.go index 7fa2e99a9c..a0ace66b7d 100644 --- a/internal/locate/region_cache.go +++ b/internal/locate/region_cache.go @@ -3078,7 +3078,7 @@ func (c *RegionCache) checkAndUpdateStoreHealthStatus(ctx context.Context, now t func (c *RegionCache) reportStoreReplicaFlows() { c.stores.forEach(func(store *Store) { for destType := toLeader; destType < numReplicaFlowsType; destType++ { - metrics.TiKVPreferLeaderFlowsGauge.WithLabelValues(destType.String(), store.addr).Set(float64(store.getReplicaFlowsStats(destType))) + metrics.TiKVPreferLeaderFlowsGauge.WithLabelValues(destType.String(), strconv.FormatUint(store.storeID, 10)).Set(float64(store.getReplicaFlowsStats(destType))) store.resetReplicaFlowsStats(destType) } })