Skip to content

Commit

Permalink
added proper return message
Browse files Browse the repository at this point in the history
Signed-off-by: Nischay <[email protected]>
  • Loading branch information
nish112022 committed Oct 30, 2024
1 parent 86b9c3e commit 086c27c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/datacoord/index_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion internal/datacoord/index_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
})
}

Expand Down
2 changes: 1 addition & 1 deletion internal/rootcoord/drop_collection_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion internal/rootcoord/drop_partition_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 086c27c

Please sign in to comment.