mirror of https://github.com/milvus-io/milvus.git
Align the maximum dim of the diskann index and collection (#23039)
Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>pull/23055/head
parent
ae0f467c02
commit
d55c860383
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue