mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-30 02:48:45 +08:00
Append field indexID for index name (#20046)
Signed-off-by: cai.zhang <cai.zhang@zilliz.com> Signed-off-by: cai.zhang <cai.zhang@zilliz.com>
This commit is contained in:
parent
7cc182cb72
commit
4848edda8d
@ -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(),
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user