diff --git a/internal/datacoord/index_service.go b/internal/datacoord/index_service.go index 4b754f86791fd..add0e93016b2d 100644 --- a/internal/datacoord/index_service.go +++ b/internal/datacoord/index_service.go @@ -817,7 +817,7 @@ func (s *Server) DropIndex(ctx context.Context, req *indexpb.DropIndexRequest) ( indexes := s.meta.indexMeta.GetIndexesForCollection(req.GetCollectionID(), req.GetIndexName()) if len(indexes) == 0 { log.Info(fmt.Sprintf("there is no index on collection: %d with the index name: %s", req.CollectionID, req.IndexName)) - return merr.Success(), nil + return merr.Status(merr.ErrIndexNotFound), nil } if !req.GetDropAll() && len(indexes) > 1 { diff --git a/internal/datacoord/index_service_test.go b/internal/datacoord/index_service_test.go index 435a54dbbc32e..32faa53f037ef 100644 --- a/internal/datacoord/index_service_test.go +++ b/internal/datacoord/index_service_test.go @@ -2185,7 +2185,7 @@ func TestServer_DropIndex(t *testing.T) { } resp, err := s.DropIndex(ctx, req) assert.NoError(t, err) - assert.Equal(t, commonpb.ErrorCode_Success, resp.GetErrorCode()) + assert.Equal(t, commonpb.ErrorCode_IndexNotExist, resp.GetErrorCode()) }) } diff --git a/internal/rootcoord/drop_collection_task.go b/internal/rootcoord/drop_collection_task.go index ce458e5cff059..d0268d427a4af 100644 --- a/internal/rootcoord/drop_collection_task.go +++ b/internal/rootcoord/drop_collection_task.go @@ -60,7 +60,7 @@ func (t *dropCollectionTask) Execute(ctx context.Context) error { if errors.Is(err, merr.ErrCollectionNotFound) { // make dropping collection idempotent. log.Warn("drop non-existent collection", zap.String("collection", t.Req.GetCollectionName())) - return nil + return merr.ErrCollectionNotFound } if err != nil { diff --git a/internal/rootcoord/drop_partition_task.go b/internal/rootcoord/drop_partition_task.go index cc45422db7f7e..9e06171b95933 100644 --- a/internal/rootcoord/drop_partition_task.go +++ b/internal/rootcoord/drop_partition_task.go @@ -29,6 +29,7 @@ import ( "github.com/milvus-io/milvus/internal/util/proxyutil" "github.com/milvus-io/milvus/pkg/common" "github.com/milvus-io/milvus/pkg/log" + "github.com/milvus-io/milvus/pkg/util/merr" ) type dropPartitionTask struct { @@ -64,7 +65,7 @@ func (t *dropPartitionTask) Execute(ctx context.Context) error { if partID == common.InvalidPartitionID { log.Warn("drop an non-existent partition", zap.String("collection", t.Req.GetCollectionName()), zap.String("partition", t.Req.GetPartitionName())) // make dropping partition idempotent. - return nil + return merr.ErrPartitionNotFound } redoTask := newBaseRedoTask(t.core.stepExecutor)