Fix querycoord ut data race (#17980)

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
pull/17987/head
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
1 changed files with 2 additions and 0 deletions

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),