From 54797b42860f5917458996b8b5fa734b1f9b15bf Mon Sep 17 00:00:00 2001 From: congqixia Date: Wed, 29 May 2024 19:15:43 +0800 Subject: [PATCH] enhance: Refine frequent log in datacoord (#33449) This PR changes: - Frequent `ListIndexes` success log to debug level - Aggregate collection missing log after collection dropped in `meta.GetCollectionIndexFilesSize` Signed-off-by: Congqi Xia Signed-off-by: Congqi Xia --- internal/datacoord/index_service.go | 2 +- internal/datacoord/meta.go | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/datacoord/index_service.go b/internal/datacoord/index_service.go index b0c68a33e3..1db44438af 100644 --- a/internal/datacoord/index_service.go +++ b/internal/datacoord/index_service.go @@ -917,7 +917,7 @@ func (s *Server) ListIndexes(ctx context.Context, req *indexpb.ListIndexesReques UserIndexParams: index.UserIndexParams, } }) - log.Info("List index success") + log.Debug("List index success") return &indexpb.ListIndexesResponse{ Status: merr.Success(), IndexInfos: indexInfos, diff --git a/internal/datacoord/meta.go b/internal/datacoord/meta.go index 434800bcb5..9b13593592 100644 --- a/internal/datacoord/meta.go +++ b/internal/datacoord/meta.go @@ -47,6 +47,7 @@ import ( "github.com/milvus-io/milvus/pkg/util/paramtable" "github.com/milvus-io/milvus/pkg/util/timerecord" "github.com/milvus-io/milvus/pkg/util/tsoutil" + "github.com/milvus-io/milvus/pkg/util/typeutil" ) type meta struct { @@ -363,6 +364,8 @@ func (m *meta) GetCollectionIndexFilesSize() uint64 { m.RLock() defer m.RUnlock() var total uint64 + + missingCollections := make(typeutil.Set[int64]) for _, segmentIdx := range m.indexMeta.GetAllSegIndexes() { coll, ok := m.collections[segmentIdx.CollectionID] if ok { @@ -370,9 +373,12 @@ func (m *meta) GetCollectionIndexFilesSize() uint64 { fmt.Sprint(segmentIdx.CollectionID), fmt.Sprint(segmentIdx.SegmentID)).Set(float64(segmentIdx.IndexSize)) total += segmentIdx.IndexSize } else { - log.Warn("not found database name", zap.Int64("collectionID", segmentIdx.CollectionID)) + missingCollections.Insert(segmentIdx.CollectionID) } } + if missingCollections.Len() > 0 { + log.Warn("collection info not found when calculating index file sizes", zap.Int64s("collectionIDs", missingCollections.Collect())) + } return total }