Fix querycoord ut data race (#17980)

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
This commit is contained in:
Jiquan Long 2022-07-01 10:58:18 +08:00 committed by GitHub
parent 641fb96958
commit 47c9e77155
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -280,11 +280,13 @@ func (qs *queryNodeServerMock) GetMetrics(ctx context.Context, req *milvuspb.Get
}
totalMemUsage := uint64(0)
globalSegInfosMutex.RLock()
for _, info := range qs.segmentInfos {
if nodeIncluded(qs.queryNodeID, info.NodeIds) {
totalMemUsage += uint64(info.MemSize)
}
}
globalSegInfosMutex.RUnlock()
nodeInfos := metricsinfo.QueryNodeInfos{
BaseComponentInfos: metricsinfo.BaseComponentInfos{
Name: metricsinfo.ConstructComponentName(typeutil.QueryNodeRole, qs.queryNodeID),