Skip to content

Commit

Permalink
enhance: Refine frequent log in datacoord (#33449)
Browse files Browse the repository at this point in the history
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 <congqi.xia@zilliz.com>

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
  • Loading branch information
congqixia committed May 29, 2024
1 parent 08b94ea commit 54797b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/datacoord/index_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 7 additions & 1 deletion internal/datacoord/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -363,16 +364,21 @@ 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 {
metrics.DataCoordStoredIndexFilesSize.WithLabelValues(coll.DatabaseName,
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
}

Expand Down

0 comments on commit 54797b4

Please sign in to comment.