mirror of https://github.com/milvus-io/milvus.git
Limit max shard num to 64 (#19776)
Signed-off-by: longjiquan <jiquan.long@zilliz.com> Signed-off-by: longjiquan <jiquan.long@zilliz.com>pull/19714/head
parent
8c9c1672ae
commit
cb51d410a2
|
@ -6,4 +6,6 @@ const (
|
|||
globalIDAllocatorSubPath = "gid"
|
||||
globalTSOAllocatorKey = "timestamp"
|
||||
globalTSOAllocatorSubPath = "tso"
|
||||
|
||||
maxShardNum = 64
|
||||
)
|
||||
|
|
|
@ -50,6 +50,10 @@ func (t *createCollectionTask) validate() error {
|
|||
return err
|
||||
}
|
||||
|
||||
if t.Req.GetShardsNum() >= maxShardNum {
|
||||
return fmt.Errorf("shard num (%d) exceeds limit (%d)", t.Req.GetShardsNum(), maxShardNum)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,17 @@ func Test_createCollectionTask_validate(t *testing.T) {
|
|||
assert.Error(t, err)
|
||||
})
|
||||
|
||||
t.Run("shard num exceeds limit", func(t *testing.T) {
|
||||
task := createCollectionTask{
|
||||
Req: &milvuspb.CreateCollectionRequest{
|
||||
Base: &commonpb.MsgBase{MsgType: commonpb.MsgType_CreateCollection},
|
||||
ShardsNum: maxShardNum + 1,
|
||||
},
|
||||
}
|
||||
err := task.validate()
|
||||
assert.Error(t, err)
|
||||
})
|
||||
|
||||
t.Run("normal case", func(t *testing.T) {
|
||||
task := createCollectionTask{
|
||||
Req: &milvuspb.CreateCollectionRequest{
|
||||
|
|
Loading…
Reference in New Issue