fix: alter index request's index name can not be empty (#31128)

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

---------

Signed-off-by: sunby <sunbingyi1992@gmail.com>
pull/31225/head
Bingyi Sun 2024-03-11 13:05:02 +08:00 committed by GitHub
parent ff1e967e89
commit 425da78b38
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -299,13 +299,17 @@ func (s *Server) AlterIndex(ctx context.Context, req *indexpb.AlterIndexRequest)
)
log.Info("received AlterIndex request", zap.Any("params", req.GetParams()))
if req.IndexName == "" {
return merr.Status(merr.WrapErrParameterInvalidMsg("index name is empty")), nil
}
if err := merr.CheckHealthy(s.GetStateCode()); err != nil {
log.Warn(msgDataCoordIsUnhealthy(paramtable.GetNodeID()), zap.Error(err))
return merr.Status(err), nil
}
indexes := s.meta.indexMeta.GetIndexesForCollection(req.GetCollectionID(), req.GetIndexName())
if req.GetIndexName() != "" && len(indexes) == 0 {
if len(indexes) == 0 {
err := merr.WrapErrIndexNotFound(req.GetIndexName())
return merr.Status(err), nil
}