Skip to content

Commit

Permalink
enhance: Return collection not loaded rather than not found on queryn…
Browse files Browse the repository at this point in the history
…ode (#38593)

issue: #38586

---------

Signed-off-by: Cai Zhang <[email protected]>
  • Loading branch information
xiaocai2333 authored Dec 23, 2024
1 parent 2356425 commit bb5f38e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/querynodev2/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions internal/querynodev2/services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit bb5f38e

Please sign in to comment.