Fix potential nil access on segment (#22104)

Signed-off-by: jaime <yun.zhang@zilliz.com>
pull/22109/head
jaime 2023-02-09 23:52:32 +08:00 committed by GitHub
parent d842711a8a
commit 5eafd96e70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -399,6 +399,7 @@ func (kc *Catalog) AlterSegmentsAndAddNewSegment(ctx context.Context, segments [
return err
}
maps.Copy(kvs, segmentKvs)
kc.collectMetrics(newSegment)
} else {
// should be a faked segment, we create flush path directly here
flushSegKey := buildFlushedSegmentPath(newSegment.GetCollectionID(), newSegment.GetPartitionID(), newSegment.GetID())
@ -412,7 +413,6 @@ func (kc *Catalog) AlterSegmentsAndAddNewSegment(ctx context.Context, segments [
}
}
kc.collectMetrics(newSegment)
return kc.MetaKv.MultiSave(kvs)
}