From 411cfadd99d92e3b4073662200f4d4ac3435d1a4 Mon Sep 17 00:00:00 2001 From: "cai.zhang" Date: Mon, 23 Dec 2024 14:36:48 +0800 Subject: [PATCH] enhance: Return collection not loaded rather than not found on querynode (#38593) issue: #38586 --------- Signed-off-by: Cai Zhang --- internal/querynodev2/services.go | 2 +- internal/querynodev2/services_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/querynodev2/services.go b/internal/querynodev2/services.go index 1eca7efe950cd..446f5fded4fa0 100644 --- a/internal/querynodev2/services.go +++ b/internal/querynodev2/services.go @@ -763,7 +763,7 @@ func (node *QueryNode) Search(ctx context.Context, req *querypb.SearchRequest) ( } collection := node.manager.Collection.Get(req.GetReq().GetCollectionID()) if collection == nil { - resp.Status = merr.Status(merr.WrapErrCollectionNotFound(req.GetReq().GetCollectionID())) + resp.Status = merr.Status(merr.WrapErrCollectionNotLoaded(req.GetReq().GetCollectionID())) return resp, nil } diff --git a/internal/querynodev2/services_test.go b/internal/querynodev2/services_test.go index 99edfa234b312..290413c11b4df 100644 --- a/internal/querynodev2/services_test.go +++ b/internal/querynodev2/services_test.go @@ -1276,8 +1276,8 @@ func (suite *ServiceSuite) TestSearch_Failed() { // collection not exist resp, err := suite.node.Search(ctx, req) suite.NoError(err) - suite.Equal(commonpb.ErrorCode_CollectionNotExists, resp.GetStatus().GetErrorCode()) - suite.Contains(resp.GetStatus().GetReason(), merr.ErrCollectionNotFound.Error()) + suite.Equal(merr.Code(merr.ErrCollectionNotLoaded), resp.GetStatus().GetCode()) + suite.Contains(resp.GetStatus().GetReason(), merr.ErrCollectionNotLoaded.Error()) // metric type mismatch LoadMeta := &querypb.LoadMetaInfo{