mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-02 11:59:00 +08:00
Fix indexcheck division by zero bug (#18482)
See also: #18479 Signed-off-by: yangxuan <xuan.yang@zilliz.com>
This commit is contained in:
parent
efc5406e78
commit
43c7c1ff03
@ -204,7 +204,7 @@ func (adapter *IVFPQConfAdapter) checkPQParams(params map[string]string) bool {
|
||||
return false
|
||||
}
|
||||
m, err := strconv.Atoi(mStr)
|
||||
if err != nil { // invalid m
|
||||
if err != nil || m == 0 { // invalid m
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -138,6 +138,9 @@ func TestIVFPQConfAdapter_CheckTrain(t *testing.T) {
|
||||
invalidParamsM[IndexMode] = GPUMode
|
||||
invalidParamsM[DIM] = strconv.Itoa(65536)
|
||||
|
||||
invalidParamsMzero := copyParams(validParams)
|
||||
invalidParamsMzero[IVFM] = "0"
|
||||
|
||||
cases := []struct {
|
||||
params map[string]string
|
||||
want bool
|
||||
@ -152,6 +155,7 @@ func TestIVFPQConfAdapter_CheckTrain(t *testing.T) {
|
||||
{invalidParamsWithoutIVF, false},
|
||||
{invalidParamsIVF, false},
|
||||
{invalidParamsM, false},
|
||||
{invalidParamsMzero, false},
|
||||
}
|
||||
|
||||
adapter := newIVFPQConfAdapter()
|
||||
|
Loading…
Reference in New Issue
Block a user