enhance: [2.5] Skip update index metrics if index dropped (#39458) (#39572)

Cherry-pick from master
pr: #39458 
Related to #39457

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/39638/head
congqixia 2025-01-24 18:21:06 +08:00 committed by GitHub
parent a48749cc11
commit 8934672687
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -214,7 +214,7 @@ func (m *indexMeta) updateIndexTasksMetrics() {
defer m.lastUpdateMetricTime.Store(time.Now())
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 {
@ -756,6 +756,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