mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 01:28:27 +08:00
Remove hardcode max shards num (#22004)
Signed-off-by: longjiquan <jiquan.long@zilliz.com>
This commit is contained in:
parent
baa035885d
commit
004a8c25ca
@ -161,7 +161,8 @@ proxy:
|
|||||||
# As of today (2.2.0 and after) it is strongly DISCOURAGED to set maxFieldNum >= 64.
|
# As of today (2.2.0 and after) it is strongly DISCOURAGED to set maxFieldNum >= 64.
|
||||||
# So adjust at your risk!
|
# So adjust at your risk!
|
||||||
maxDimension: 32768 # Maximum dimension of a vector
|
maxDimension: 32768 # Maximum dimension of a vector
|
||||||
maxShardNum: 256 # Maximum number of shards in a collection
|
# It is strongly DISCOURAGED to set `maxShardNum` > 64.
|
||||||
|
maxShardNum: 64 # Maximum number of shards in a collection
|
||||||
maxTaskNum: 1024 # max task number of proxy task queue
|
maxTaskNum: 1024 # max task number of proxy task queue
|
||||||
# please adjust in embedded Milvus: false
|
# please adjust in embedded Milvus: false
|
||||||
ginLogging: true # Whether to produce gin logs.
|
ginLogging: true # Whether to produce gin logs.
|
||||||
|
|||||||
@ -51,8 +51,16 @@ func (t *createCollectionTask) validate() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if t.Req.GetShardsNum() >= maxShardNum {
|
shardsNum := t.Req.GetShardsNum()
|
||||||
return fmt.Errorf("shard num (%d) exceeds limit (%d)", t.Req.GetShardsNum(), maxShardNum)
|
|
||||||
|
cfgMaxShardNum := Params.RootCoordCfg.DmlChannelNum.GetAsInt32()
|
||||||
|
if shardsNum > cfgMaxShardNum {
|
||||||
|
return fmt.Errorf("shard num (%d) exceeds max configuration (%d)", shardsNum, cfgMaxShardNum)
|
||||||
|
}
|
||||||
|
|
||||||
|
cfgShardLimit := Params.ProxyCfg.MaxShardNum.GetAsInt32()
|
||||||
|
if shardsNum > cfgShardLimit {
|
||||||
|
return fmt.Errorf("shard num (%d) exceeds system limit (%d)", shardsNum, cfgShardLimit)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -40,11 +40,26 @@ func Test_createCollectionTask_validate(t *testing.T) {
|
|||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("shard num exceeds limit", func(t *testing.T) {
|
t.Run("shard num exceeds max configuration", func(t *testing.T) {
|
||||||
|
// TODO: better to have a `Set` method for ParamItem.
|
||||||
|
cfgMaxShardNum := Params.RootCoordCfg.DmlChannelNum.GetAsInt32()
|
||||||
task := createCollectionTask{
|
task := createCollectionTask{
|
||||||
Req: &milvuspb.CreateCollectionRequest{
|
Req: &milvuspb.CreateCollectionRequest{
|
||||||
Base: &commonpb.MsgBase{MsgType: commonpb.MsgType_CreateCollection},
|
Base: &commonpb.MsgBase{MsgType: commonpb.MsgType_CreateCollection},
|
||||||
ShardsNum: maxShardNum + 1,
|
ShardsNum: cfgMaxShardNum + 1,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
err := task.validate()
|
||||||
|
assert.Error(t, err)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("shard num exceeds limit", func(t *testing.T) {
|
||||||
|
// TODO: better to have a `Set` method for ParamItem.
|
||||||
|
cfgShardLimit := Params.ProxyCfg.MaxShardNum.GetAsInt32()
|
||||||
|
task := createCollectionTask{
|
||||||
|
Req: &milvuspb.CreateCollectionRequest{
|
||||||
|
Base: &commonpb.MsgBase{MsgType: commonpb.MsgType_CreateCollection},
|
||||||
|
ShardsNum: cfgShardLimit + 1,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
err := task.validate()
|
err := task.validate()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user