diff --git a/internal/proxy/task.go b/internal/proxy/task.go index 5bfcf4ab3fa45..724634a34717e 100644 --- a/internal/proxy/task.go +++ b/internal/proxy/task.go @@ -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 diff --git a/internal/proxy/task_test.go b/internal/proxy/task_test.go index 2eb4b219e2921..fbc9c93717d89 100644 --- a/internal/proxy/task_test.go +++ b/internal/proxy/task_test.go @@ -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)