From fa69c71d35178aabe358b184b4ca223664ab4c64 Mon Sep 17 00:00:00 2001 From: yah01 Date: Thu, 8 Jun 2023 13:58:35 +0800 Subject: [PATCH] Fix data race in MetaCache (#24739) Signed-off-by: yah01 --- internal/proxy/meta_cache.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/proxy/meta_cache.go b/internal/proxy/meta_cache.go index a89960f009..4b8d6924fa 100644 --- a/internal/proxy/meta_cache.go +++ b/internal/proxy/meta_cache.go @@ -384,6 +384,8 @@ func (m *MetaCache) GetPartitions(ctx context.Context, collectionName string) (m metrics.ProxyCacheStatsCounter.WithLabelValues(strconv.FormatInt(paramtable.GetNodeID(), 10), "GetPartitions", metrics.CacheHitLabel).Inc() ret := make(map[string]typeutil.UniqueID) + m.mu.RLock() + defer m.mu.RUnlock() partInfo := m.collInfo[collectionName].partInfo for k, v := range partInfo { ret[k] = v.partitionID