From 317e3e8f0cb21bcd4f5ef1f241ed3575d6ead2cb Mon Sep 17 00:00:00 2001 From: bigsheeper Date: Tue, 17 Dec 2024 17:04:46 +0800 Subject: [PATCH] code format Signed-off-by: bigsheeper --- internal/rootcoord/constrant_test.go | 11 +++++++---- internal/rootcoord/meta_table.go | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/internal/rootcoord/constrant_test.go b/internal/rootcoord/constrant_test.go index b49fdee5a7a95..ed68877551dba 100644 --- a/internal/rootcoord/constrant_test.go +++ b/internal/rootcoord/constrant_test.go @@ -59,13 +59,16 @@ func TestCheckGeneralCapacity(t *testing.T) { catalog.EXPECT().CreateCollection(mock.Anything, mock.Anything, mock.Anything).Return(nil) err = meta.CreateDatabase(ctx, &model.Database{}, typeutil.MaxTimestamp) - err = meta.AddCollection(ctx, &model.Collection{CollectionID: 1, - State: pb.CollectionState_CollectionCreating, - ShardsNum: 256, + assert.Error(t, err) + err = meta.AddCollection(ctx, &model.Collection{ + CollectionID: 1, + State: pb.CollectionState_CollectionCreating, + ShardsNum: 256, Partitions: []*model.Partition{ {PartitionID: 100, State: pb.PartitionState_PartitionCreated}, {PartitionID: 200, State: pb.PartitionState_PartitionCreated}, - }}) + }, + }) assert.NoError(t, err) assert.Equal(t, 0, meta.GetGeneralCount(ctx)) diff --git a/internal/rootcoord/meta_table.go b/internal/rootcoord/meta_table.go index 3b1b1a793500e..473e49ac9ac7f 100644 --- a/internal/rootcoord/meta_table.go +++ b/internal/rootcoord/meta_table.go @@ -459,7 +459,7 @@ func (mt *MetaTable) ChangeCollectionState(ctx context.Context, collectionID Uni mt.generalCnt += pn * int(coll.ShardsNum) metrics.RootCoordNumOfCollections.WithLabelValues(db.Name).Inc() metrics.RootCoordNumOfPartitions.WithLabelValues().Add(float64(pn)) - default: + case pb.CollectionState_CollectionDropping: mt.generalCnt -= pn * int(coll.ShardsNum) metrics.RootCoordNumOfCollections.WithLabelValues(db.Name).Dec() metrics.RootCoordNumOfPartitions.WithLabelValues().Sub(float64(pn)) @@ -908,7 +908,7 @@ func (mt *MetaTable) ChangePartitionState(ctx context.Context, collectionID Uniq mt.generalCnt += int(coll.ShardsNum) // 1 partition * shardNum // support Dynamic load/release partitions metrics.RootCoordNumOfPartitions.WithLabelValues().Inc() - default: + case pb.PartitionState_PartitionDropping: mt.generalCnt -= int(coll.ShardsNum) // 1 partition * shardNum metrics.RootCoordNumOfPartitions.WithLabelValues().Dec() }