From 56b4b776b86d90cd6f38245e5f831b645f70e627 Mon Sep 17 00:00:00 2001 From: wayblink Date: Tue, 29 Oct 2024 17:14:00 +0800 Subject: [PATCH] fix hasCollection response has no status Signed-off-by: wayblink --- internal/proxy/task.go | 5 ++++- internal/proxy/task_test.go | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) 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)