mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 09:08:43 +08:00
fix: remove validateFieldName in dropIndex (#45460)
issue: https://github.com/milvus-io/milvus/issues/45459 This check is unnecessary when dropping index. --------- Signed-off-by: SpadeA <tangchenjie1210@gmail.com>
This commit is contained in:
parent
1c69c7fa17
commit
0454cdaab3
@ -1045,18 +1045,6 @@ func (dit *dropIndexTask) OnEnqueue() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (dit *dropIndexTask) PreExecute(ctx context.Context) error {
|
func (dit *dropIndexTask) PreExecute(ctx context.Context) error {
|
||||||
collName, fieldName := dit.CollectionName, dit.FieldName
|
|
||||||
|
|
||||||
if err := validateCollectionName(collName); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if fieldName != "" {
|
|
||||||
if err := validateFieldName(fieldName); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
collID, err := globalMetaCache.GetCollectionID(ctx, dit.GetDbName(), dit.CollectionName)
|
collID, err := globalMetaCache.GetCollectionID(ctx, dit.GetDbName(), dit.CollectionName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@ -202,50 +202,6 @@ class TestAsyncMilvusClientIndexInvalid(TestMilvusClientV2Base):
|
|||||||
# 3. drop action
|
# 3. drop action
|
||||||
await async_client.drop_collection(collection_name)
|
await async_client.drop_collection(collection_name)
|
||||||
|
|
||||||
@pytest.mark.tags(CaseLabel.L1)
|
|
||||||
@pytest.mark.parametrize("name", ["12-s", "12 s", "(mn)", "中文", "%$#"])
|
|
||||||
async def test_async_milvus_client_drop_index_invalid_collection_name(self, name):
|
|
||||||
"""
|
|
||||||
target: test drop index with invalid collection name
|
|
||||||
method: drop index with invalid collection name
|
|
||||||
expected: raise exception
|
|
||||||
"""
|
|
||||||
self.init_async_milvus_client()
|
|
||||||
async_client = self.async_milvus_client_wrap
|
|
||||||
|
|
||||||
# 1. create collection
|
|
||||||
collection_name = cf.gen_unique_str(prefix)
|
|
||||||
await async_client.create_collection(collection_name, default_dim, consistency_level="Strong")
|
|
||||||
await async_client.release_collection(collection_name)
|
|
||||||
# 2. drop index
|
|
||||||
error = {ct.err_code: 1100, ct.err_msg: f"Invalid collection name: {name}. the first character of a collection "
|
|
||||||
f"name must be an underscore or letter: invalid parameter"}
|
|
||||||
await async_client.drop_index(name, "vector", check_task=CheckTasks.err_res, check_items=error)
|
|
||||||
# 3. drop action
|
|
||||||
await async_client.drop_collection(collection_name)
|
|
||||||
|
|
||||||
@pytest.mark.tags(CaseLabel.L1)
|
|
||||||
@pytest.mark.parametrize("name", ["a".join("a" for i in range(256))])
|
|
||||||
async def test_async_milvus_client_drop_index_collection_name_over_max_length(self, name):
|
|
||||||
"""
|
|
||||||
target: test drop index with over max collection name length
|
|
||||||
method: drop index with over max collection name length
|
|
||||||
expected: raise exception
|
|
||||||
"""
|
|
||||||
self.init_async_milvus_client()
|
|
||||||
async_client = self.async_milvus_client_wrap
|
|
||||||
|
|
||||||
# 1. create collection
|
|
||||||
collection_name = cf.gen_unique_str(prefix)
|
|
||||||
await async_client.create_collection(collection_name, default_dim, consistency_level="Strong")
|
|
||||||
await async_client.release_collection(collection_name)
|
|
||||||
# 2. drop index
|
|
||||||
error = {ct.err_code: 1100, ct.err_msg: f"Invalid collection name: {name}. the length of a collection name "
|
|
||||||
f"must be less than 255 characters: invalid parameter"}
|
|
||||||
await async_client.drop_index(name, "vector", check_task=CheckTasks.err_res, check_items=error)
|
|
||||||
# 3. drop action
|
|
||||||
await async_client.drop_collection(collection_name)
|
|
||||||
|
|
||||||
class TestAsyncMilvusClientIndexValid(TestMilvusClientV2Base):
|
class TestAsyncMilvusClientIndexValid(TestMilvusClientV2Base):
|
||||||
""" Test case of index interface """
|
""" Test case of index interface """
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user