Align the maximum dim of the diskann index and collection (#23039)

Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>
pull/23055/head
zhenshan.cao 2023-03-28 00:06:00 +08:00 committed by GitHub
parent ae0f467c02
commit d55c860383
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 4 deletions

View File

@ -23,7 +23,6 @@
#include "storage/LocalChunkManager.h"
#include "storage/Util.h"
#include "common/Consts.h"
#include "common/Utils.h"
#include "common/RangeSearchHelper.h"
namespace milvus::index {

View File

@ -146,7 +146,7 @@ func TestCurrencyGlobalMethods(t *testing.T) {
data := prefix + fmt.Sprintf(": %d-th goroutine", idx)
err := ZstdCompress(strings.NewReader(data), compressed, zstd.WithEncoderLevel(zstd.EncoderLevelFromZstd(idx)))
err := ZstdCompress(strings.NewReader(data), compressed)
assert.NoError(t, err)
compressedBytes = ZstdCompressBytes([]byte(data), compressedBytes)
assert.Equal(t, compressed.Bytes(), compressedBytes)

View File

@ -63,7 +63,6 @@ const (
// If Dim = 2, and raw vector data = 2G, query node need 240G disk space When loading the vectors' disk index
// So DiskAnnMinDim should be greater than or equal to 32 to avoid running out of disk space
DiskAnnMinDim = 32
DiskAnnMaxDim = 1024
HNSWMinEfConstruction = 8
HNSWMaxEfConstruction = 512
@ -345,7 +344,7 @@ type DISKANNConfAdapter struct {
}
func (adapter *DISKANNConfAdapter) CheckTrain(params map[string]string) bool {
if !CheckIntByRange(params, DIM, DiskAnnMinDim, DiskAnnMaxDim) {
if !CheckIntByRange(params, DIM, DiskAnnMinDim, DefaultMaxDim) {
return false
}
return adapter.BaseConfAdapter.CheckTrain(params)

View File

@ -335,3 +335,36 @@ func TestANNOYConfAdapter_CheckTrain(t *testing.T) {
}
}
}
func TestDiskAnnConfAdapter_CheckTrain(t *testing.T) {
validParams := map[string]string{
DIM: strconv.Itoa(128),
Metric: L2,
}
validParamsBigDim := copyParams(validParams)
validParamsBigDim[DIM] = strconv.Itoa(2048)
invalidParamsWithoutDim := map[string]string{
Metric: L2,
}
invalidParamsSmallDim := copyParams(validParams)
invalidParamsSmallDim[DIM] = strconv.Itoa(15)
cases := []struct {
params map[string]string
want bool
}{
{validParams, true},
{validParamsBigDim, true},
{invalidParamsWithoutDim, false},
{invalidParamsSmallDim, false},
}
adapter := newDISKANNConfAdapter()
for _, test := range cases {
if got := adapter.CheckTrain(test.params); got != test.want {
t.Errorf("DiskAnnConfAdapter.CheckTrain(%v) = %v", test.params, test.want)
}
}
}