diff --git a/internal/util/indexparamcheck/conf_adapter.go b/internal/util/indexparamcheck/conf_adapter.go index c687cd7c17..9f1fd55787 100644 --- a/internal/util/indexparamcheck/conf_adapter.go +++ b/internal/util/indexparamcheck/conf_adapter.go @@ -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 } diff --git a/internal/util/indexparamcheck/conf_adapter_test.go b/internal/util/indexparamcheck/conf_adapter_test.go index dd351077e5..9063151be4 100644 --- a/internal/util/indexparamcheck/conf_adapter_test.go +++ b/internal/util/indexparamcheck/conf_adapter_test.go @@ -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()