fix: the incorrect number of partitions in rootcoord meta (#35601)

pr: #35600

Signed-off-by: jaime <yun.zhang@zilliz.com>
pull/35674/head
jaime 2024-08-25 16:30:59 +08:00 committed by GitHub
parent 4b5bd07971
commit 5c1a380d9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 5 deletions

View File

@ -137,8 +137,6 @@ func (mt *MetaTable) reload() error {
mt.names = newNameDb()
mt.aliases = newNameDb()
partitionNum := int64(0)
metrics.RootCoordNumOfCollections.Reset()
metrics.RootCoordNumOfPartitions.Reset()
metrics.RootCoordNumOfDatabases.Set(0)
@ -172,12 +170,14 @@ func (mt *MetaTable) reload() error {
// recover collections from db namespace
for dbName, db := range mt.dbName2Meta {
partitionNum := int64(0)
collectionNum := int64(0)
mt.names.createDbIfNotExist(dbName)
collections, err := mt.catalog.ListCollections(mt.ctx, db.ID, typeutil.MaxTimestamp)
if err != nil {
return err
}
collectionNum := int64(0)
for _, collection := range collections {
mt.collID2Meta[collection.CollectionID] = collection
if collection.Available() {
@ -189,6 +189,7 @@ func (mt *MetaTable) reload() error {
metrics.RootCoordNumOfDatabases.Inc()
metrics.RootCoordNumOfCollections.WithLabelValues(dbName).Add(float64(collectionNum))
metrics.RootCoordNumOfPartitions.WithLabelValues().Add(float64(partitionNum))
log.Info("collections recovered from db", zap.String("db_name", dbName),
zap.Int64("collection_num", collectionNum),
zap.Int64("partition_num", partitionNum))
@ -205,8 +206,6 @@ func (mt *MetaTable) reload() error {
mt.aliases.insert(dbName, alias.Name, alias.CollectionID)
}
}
metrics.RootCoordNumOfPartitions.WithLabelValues().Add(float64(partitionNum))
log.Info("RootCoord meta table reload done", zap.Duration("duration", record.ElapseSpan()))
return nil
}