From 1a1ed07cfa13d07275f00fc8880e96012da8586b Mon Sep 17 00:00:00 2001 From: congqixia Date: Wed, 22 Jan 2025 11:19:04 +0800 Subject: [PATCH] enhance: Skip update index metrics if index dropped (#39458) Related to #39457 Signed-off-by: Congqi Xia --- internal/datacoord/index_meta.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/datacoord/index_meta.go b/internal/datacoord/index_meta.go index 361637ab6e..26d37befa6 100644 --- a/internal/datacoord/index_meta.go +++ b/internal/datacoord/index_meta.go @@ -207,7 +207,7 @@ func (m *indexMeta) updateSegIndexMeta(segIdx *model.SegmentIndex, updateFunc fu func (m *indexMeta) updateIndexTasksMetrics() { taskMetrics := make(map[UniqueID]map[commonpb.IndexState]int) for _, segIdx := range m.segmentBuildInfo.List() { - if segIdx.IsDeleted { + if segIdx.IsDeleted || !m.isIndexExist(segIdx.CollectionID, segIdx.IndexID) { continue } if _, ok := taskMetrics[segIdx.CollectionID]; !ok { @@ -748,6 +748,10 @@ func (m *indexMeta) IsIndexExist(collID, indexID UniqueID) bool { m.RLock() defer m.RUnlock() + return m.isIndexExist(collID, indexID) +} + +func (m *indexMeta) isIndexExist(collID, indexID UniqueID) bool { fieldIndexes, ok := m.indexes[collID] if !ok { return false