Skip to content

Commit

Permalink
fix: fix hasCollection response has no status (#37254)
Browse files Browse the repository at this point in the history
issue: #37257

Signed-off-by: wayblink <[email protected]>
  • Loading branch information
wayblink authored Nov 1, 2024
1 parent be71b98 commit d119a25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/proxy/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -565,10 +565,13 @@ func (t *hasCollectionTask) PreExecute(ctx context.Context) error {
}

func (t *hasCollectionTask) Execute(ctx context.Context) error {
t.result = &milvuspb.BoolResponse{
Status: merr.Success(),
}
_, err := globalMetaCache.GetCollectionID(ctx, t.HasCollectionRequest.GetDbName(), t.HasCollectionRequest.GetCollectionName())
t.result = &milvuspb.BoolResponse{}
// error other than
if err != nil && !errors.Is(err, merr.ErrCollectionNotFound) {
t.result.Status = merr.Status(err)
return err
}
// if collection not nil, means error is ErrCollectionNotFound, result is false
Expand Down
1 change: 1 addition & 0 deletions internal/proxy/task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,7 @@ func TestHasCollectionTask(t *testing.T) {
err = task.Execute(ctx)
assert.NoError(t, err)
assert.False(t, task.result.GetValue())
assert.NotNil(t, task.result.GetStatus())

// rootcoord failed to get response
rc.updateState(commonpb.StateCode_Abnormal)
Expand Down

0 comments on commit d119a25

Please sign in to comment.