fix: alter_index should return error if index not found (#30786)

issue: https://github.com/milvus-io/milvus/issues/30932

Signed-off-by: sunby <sunbingyi1992@gmail.com>
pull/30934/head
Bingyi Sun 2024-02-29 15:55:01 +08:00 committed by GitHub
parent dcfc35316f
commit 816ed671aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -291,6 +291,10 @@ func (s *Server) AlterIndex(ctx context.Context, req *indexpb.AlterIndexRequest)
}
indexes := s.meta.GetIndexesForCollection(req.GetCollectionID(), req.GetIndexName())
if req.GetIndexName() != "" && len(indexes) == 0 {
err := merr.WrapErrIndexNotFound(req.GetIndexName())
return merr.Status(err), nil
}
for _, index := range indexes {
// update user index params
newUserIndexParams, err := UpdateParams(index, index.UserIndexParams, req.GetParams())