Skip to content

Commit

Permalink
fix hasCollection response has no status
Browse files Browse the repository at this point in the history
Signed-off-by: wayblink <[email protected]>
  • Loading branch information
wayblink committed Oct 30, 2024
1 parent 86b9c3e commit 56b4b77
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 @@ -564,10 +564,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 56b4b77

Please sign in to comment.