mirror of https://github.com/milvus-io/milvus.git
Don't build BIN_FLAT index really (#20309)
Signed-off-by: cai.zhang <cai.zhang@zilliz.com> Signed-off-by: cai.zhang <cai.zhang@zilliz.com>pull/20013/head
parent
e7103310b8
commit
6c4658db22
|
@ -24,6 +24,7 @@ const (
|
|||
CreateIndexTaskName = "CreateIndexTask"
|
||||
|
||||
flatIndex = "FLAT"
|
||||
binFlatIndex = "BIN_FLAT"
|
||||
diskAnnIndex = "DISKANN"
|
||||
invalidIndex = "invalid"
|
||||
|
||||
|
|
|
@ -26,8 +26,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
|
||||
clientv3 "go.etcd.io/etcd/client/v3"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/milvus-io/milvus-proto/go-api/commonpb"
|
||||
|
@ -51,7 +49,6 @@ type flushedSegmentWatcher struct {
|
|||
internalNotify chan struct{}
|
||||
|
||||
etcdRevision int64
|
||||
watchChan clientv3.WatchChan
|
||||
|
||||
meta *metaTable
|
||||
builder *indexBuilder
|
||||
|
|
|
@ -153,7 +153,6 @@ func Test_flushedSegmentWatcher_internalRun(t *testing.T) {
|
|||
internalTaskMutex: sync.RWMutex{},
|
||||
internalNotify: make(chan struct{}, 1),
|
||||
etcdRevision: 0,
|
||||
watchChan: nil,
|
||||
meta: nil,
|
||||
builder: nil,
|
||||
ic: &IndexCoord{
|
||||
|
@ -493,7 +492,6 @@ func Test_flushSegmentWatcher_prepare_error(t *testing.T) {
|
|||
internalTaskMutex: sync.RWMutex{},
|
||||
internalNotify: make(chan struct{}, 1),
|
||||
etcdRevision: 0,
|
||||
watchChan: nil,
|
||||
meta: nil,
|
||||
builder: nil,
|
||||
ic: &IndexCoord{
|
||||
|
@ -527,7 +525,6 @@ func Test_flushSegmentWatcher_prepare_error(t *testing.T) {
|
|||
internalTaskMutex: sync.RWMutex{},
|
||||
internalNotify: make(chan struct{}, 1),
|
||||
etcdRevision: 0,
|
||||
watchChan: nil,
|
||||
meta: nil,
|
||||
builder: nil,
|
||||
ic: &IndexCoord{
|
||||
|
@ -640,7 +637,6 @@ func Test_flushSegmentWatcher_constructTask_error(t *testing.T) {
|
|||
internalTaskMutex: sync.RWMutex{},
|
||||
internalNotify: make(chan struct{}, 1),
|
||||
etcdRevision: 0,
|
||||
watchChan: nil,
|
||||
meta: meta,
|
||||
builder: nil,
|
||||
ic: &IndexCoord{
|
||||
|
|
|
@ -213,7 +213,7 @@ func (ib *indexBuilder) process(buildID UniqueID) bool {
|
|||
return true
|
||||
}
|
||||
indexParams := ib.meta.GetIndexParams(meta.CollectionID, meta.IndexID)
|
||||
if getIndexType(indexParams) == flatIndex || meta.NumRows < Params.IndexCoordCfg.MinSegmentNumRowsToEnableIndex {
|
||||
if isFlatIndex(getIndexType(indexParams)) || meta.NumRows < Params.IndexCoordCfg.MinSegmentNumRowsToEnableIndex {
|
||||
log.Ctx(ib.ctx).Debug("segment does not need index really", zap.Int64("buildID", buildID),
|
||||
zap.Int64("segID", meta.SegmentID), zap.Int64("num rows", meta.NumRows))
|
||||
if err := ib.meta.FinishTask(&indexpb.IndexTaskInfo{
|
||||
|
|
|
@ -82,3 +82,7 @@ func getIndexType(indexParams []*commonpb.KeyValuePair) string {
|
|||
}
|
||||
return invalidIndex
|
||||
}
|
||||
|
||||
func isFlatIndex(indexType string) bool {
|
||||
return indexType == flatIndex || indexType == binFlatIndex
|
||||
}
|
||||
|
|
|
@ -89,3 +89,9 @@ func Test_parseKey(t *testing.T) {
|
|||
_, err2 := parseBuildIDFromFilePath(key2)
|
||||
assert.Error(t, err2)
|
||||
}
|
||||
|
||||
func Test_isFlatIndex(t *testing.T) {
|
||||
assert.True(t, isFlatIndex(flatIndex))
|
||||
assert.True(t, isFlatIndex(binFlatIndex))
|
||||
assert.False(t, isFlatIndex(diskAnnIndex))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue