Skip to content

Commit

Permalink
code format
Browse files Browse the repository at this point in the history
Signed-off-by: bigsheeper <[email protected]>
  • Loading branch information
bigsheeper committed Dec 17, 2024
1 parent b478956 commit 317e3e8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions internal/rootcoord/constrant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions internal/rootcoord/meta_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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()
}
Expand Down

0 comments on commit 317e3e8

Please sign in to comment.