Fix a panic issue while reporting metrics (#20776)

issue: #20771

/kind bug

Signed-off-by: Yuchen Gao <yuchen.gao@zilliz.com>

Signed-off-by: Yuchen Gao <yuchen.gao@zilliz.com>
pull/20813/head
Ten Thousand Leaves 2022-11-24 17:37:13 +08:00 committed by GitHub
parent 81d0056e83
commit 3cde5b53ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -585,17 +585,18 @@ func (m *meta) UpdateDropChannelSegmentInfo(channel string, segments []*SegmentI
// mergeDropSegment merges drop segment information with meta segments
func (m *meta) mergeDropSegment(seg2Drop *SegmentInfo) (*SegmentInfo, *segMetricMutation) {
metricMutation := &segMetricMutation{
stateChange: make(map[string]int),
}
segment := m.segments.GetSegment(seg2Drop.ID)
// healthy check makes sure the Idempotence
if segment == nil || !isSegmentHealthy(segment) {
log.Warn("UpdateDropChannel skipping nil or unhealthy", zap.Bool("is nil", segment == nil),
zap.Bool("isHealthy", isSegmentHealthy(segment)))
return nil, nil
return nil, metricMutation
}
metricMutation := &segMetricMutation{
stateChange: make(map[string]int),
}
clonedSegment := segment.Clone()
updateSegStateAndPrepareMetrics(clonedSegment, commonpb.SegmentState_Dropped, metricMutation)

View File

@ -975,7 +975,7 @@ class TestUtilityBase(TestcaseBase):
assert collection_w.num_entities == nb
collection_w.create_index(ct.default_float_vec_field_name, index_params=ct.default_flat_index)
collection_w.load(_async=True)
self.utility_wrap.wait_for_loading_complete(collection_w.name)
self.utility_wrap.wait_for_loading_complete(collection_w.name, timeout=45)
res, _ = self.utility_wrap.loading_progress(collection_w.name)
assert res[loading_progress] == '100%'