fix: Refine the err msg of alter index invalid (#39137)

fix: Refine the err msg of alter index invalid
issue: https://github.com/milvus-io/milvus/issues/38517

Signed-off-by: Xianhui.Lin <xianhui.lin@zilliz.com>
This commit is contained in:
Xianhui Lin 2025-01-10 12:08:57 +08:00 committed by GitHub
parent 7d32603d4d
commit e5eb1159e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 5 deletions

View File

@ -619,13 +619,13 @@ func (t *alterIndexTask) PreExecute(ctx context.Context) error {
if len(t.req.GetExtraParams()) > 0 {
for _, param := range t.req.GetExtraParams() {
if !indexparams.IsConfigableIndexParam(param.GetKey()) {
return merr.WrapErrParameterInvalidMsg("%s is not a configable index proptery", param.GetKey())
return merr.WrapErrParameterInvalidMsg("%s is not a configable index property", param.GetKey())
}
}
} else if len(t.req.GetDeleteKeys()) > 0 {
for _, param := range t.req.GetDeleteKeys() {
if !indexparams.IsConfigableIndexParam(param) {
return merr.WrapErrParameterInvalidMsg("%s is not a configable index proptery", param)
return merr.WrapErrParameterInvalidMsg("%s is not a configable index property", param)
}
}
}

View File

@ -40,7 +40,7 @@ class IndexErrorMessage(ExceptionsMessage):
CheckBitmapIndex = "bitmap index are only supported on bool, int, string"
CheckBitmapOnPK = "create bitmap index on primary key not supported"
CheckBitmapCardinality = "failed to check bitmap cardinality limit, should be larger than 0 and smaller than 1000"
NotConfigable = "{0} is not a configable index proptery"
NotConfigable = "{0} is not a configable index property"
InvalidOffsetCache = "invalid offset cache index params"
OneIndexPerField = "at most one distinct index is allowed per field"
AlterOnLoadedCollection = "can't alter index on loaded collection, please release the collection first"

View File

@ -85,7 +85,7 @@ class TestMilvusClientAlterIndex(TestMilvusClientV2Base):
for p in properties.items():
if p[0] not in ["mmap.enabled"]:
log.debug(f"try to alter index property: {p[0]}")
error = {ct.err_code: 1, ct.err_msg: f"{p[0]} is not a configable index proptery"}
error = {ct.err_code: 1, ct.err_msg: f"{p[0]} is not a configable index property"}
new_value = p[1] + 1 if isinstance(p[1], numbers.Number) else "new_value"
self.alter_index_properties(client, collection_name, vector_field_name,
properties={p[0]: new_value},

View File

@ -1428,7 +1428,7 @@ class TestIndexInvalid(TestcaseBase):
collection_w.alter_index(ct.default_index_name, {"error_param_key": 123},
check_task=CheckTasks.err_res,
check_items={ct.err_code: 1100,
ct.err_msg: "error_param_key is not a configable index proptery:"})
ct.err_msg: "error_param_key is not a configable index property:"})
collection_w.alter_index(ct.default_index_name, ["error_param_type"],
check_task=CheckTasks.err_res,
check_items={ct.err_code: 1,