diff --git a/cmd/tools/migration/meta/210_to_220.go b/cmd/tools/migration/meta/210_to_220.go index 0b40a693f6..4e4553407a 100644 --- a/cmd/tools/migration/meta/210_to_220.go +++ b/cmd/tools/migration/meta/210_to_220.go @@ -3,6 +3,7 @@ package meta import ( "fmt" "sort" + "strconv" "strings" "github.com/milvus-io/milvus-proto/go-api/commonpb" @@ -172,12 +173,16 @@ func combineToCollectionIndexesMeta220(fieldIndexes FieldIndexes210, collectionI for k, v := range newIndexParamsMap { newIndexParams = append(newIndexParams, &commonpb.KeyValuePair{Key: k, Value: v}) } + newIndexName := indexInfo.GetIndexName() + if newIndexName == "_default_idx" { + newIndexName = "_default_idx_" + strconv.FormatInt(index.GetFiledID(), 10) + } record := &model.Index{ TenantID: "", // TODO: how to set this if we support mysql later? CollectionID: collectionID, FieldID: index.GetFiledID(), IndexID: index.GetIndexID(), - IndexName: indexInfo.GetIndexName(), + IndexName: newIndexName, IsDeleted: indexInfo.GetDeleted(), CreateTime: indexInfo.GetCreateTime(), TypeParams: field.GetTypeParams(), diff --git a/internal/proxy/task_index.go b/internal/proxy/task_index.go index 94c533eb41..4482a9903d 100644 --- a/internal/proxy/task_index.go +++ b/internal/proxy/task_index.go @@ -498,6 +498,9 @@ func (dit *dropIndexTask) PreExecute(ctx context.Context) error { dit.Base.MsgType = commonpb.MsgType_DropIndex dit.Base.SourceID = Params.ProxyCfg.GetNodeID() + if dit.GetIndexName() == "" { + return errors.New("IndexName is not specified") + } collName, fieldName := dit.CollectionName, dit.FieldName if err := validateCollectionName(collName); err != nil { @@ -508,10 +511,6 @@ func (dit *dropIndexTask) PreExecute(ctx context.Context) error { return err } - if dit.IndexName == "" { - dit.IndexName = Params.CommonCfg.DefaultIndexName - } - collID, err := globalMetaCache.GetCollectionID(ctx, dit.CollectionName) if err != nil { return err diff --git a/internal/proxy/task_index_test.go b/internal/proxy/task_index_test.go index ac2bf5aa20..06b5d7616f 100644 --- a/internal/proxy/task_index_test.go +++ b/internal/proxy/task_index_test.go @@ -96,7 +96,7 @@ func TestDropIndexTask_PreExecute(t *testing.T) { collectionName := "collection1" collectionID := UniqueID(1) fieldName := "field1" - indexName := "" + indexName := "_default_idx_101" Params.Init() showCollectionMock := func(ctx context.Context, request *querypb.ShowCollectionsRequest) (*querypb.ShowCollectionsResponse, error) { diff --git a/tests/python_client/requirements.txt b/tests/python_client/requirements.txt index 6c1cb9e302..cfacc95d81 100644 --- a/tests/python_client/requirements.txt +++ b/tests/python_client/requirements.txt @@ -12,7 +12,7 @@ allure-pytest==2.7.0 pytest-print==0.2.1 pytest-level==0.1.1 pytest-xdist==2.5.0 -pymilvus==2.2.0.dev67 +pymilvus==2.2.0.dev68 pytest-rerunfailures==9.1.1 git+https://github.com/Projectplace/pytest-tags ndg-httpsclient