Skip to content

Commit

Permalink
Handle legacy querynode Delete Unimplemented (#27749)
Browse files Browse the repository at this point in the history
Signed-off-by: Congqi Xia <[email protected]>
  • Loading branch information
congqixia authored Oct 17, 2023
1 parent 2f16339 commit 1f2a76d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
16 changes: 6 additions & 10 deletions internal/querynodev2/cluster/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,13 @@ func (w *remoteWorker) Delete(ctx context.Context, req *querypb.DeleteRequest) e
zap.Int64("workerID", req.GetBase().GetTargetID()),
)
status, err := w.client.Delete(ctx, req)
if err != nil {
log.Warn("failed to call Delete via grpc worker",
zap.Error(err),
)
if err := merr.CheckRPCCall(status, err); err != nil {
if funcutil.IsGrpcErr(err, codes.Unimplemented) {
log.Warn("invoke legacy querynode Delete method, ignore error", zap.Error(err))
return nil
}
log.Warn("failed to call Delete, worker return error", zap.Error(err))
return err
} else if status.GetErrorCode() != commonpb.ErrorCode_Success {
log.Warn("failed to call Delete, worker return error",
zap.String("errorCode", status.GetErrorCode().String()),
zap.String("reason", status.GetReason()),
)
return merr.Error(status)
}
return nil
}
Expand Down
13 changes: 13 additions & 0 deletions internal/querynodev2/cluster/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,19 @@ func (s *RemoteWorkerSuite) TestDelete() {

s.Error(err)
})

s.Run("legacy_querynode_unimplemented", func() {
defer func() { s.mockClient.ExpectedCalls = nil }()

s.mockClient.EXPECT().Delete(mock.Anything, mock.AnythingOfType("*querypb.DeleteRequest")).
Return(nil, status.Errorf(codes.Unimplemented, "mocked grpc unimplemented"))

ctx, cancel := context.WithCancel(context.Background())
defer cancel()
err := s.worker.Delete(ctx, &querypb.DeleteRequest{})

s.NoError(err)
})
}

func (s *RemoteWorkerSuite) TestSearch() {
Expand Down

0 comments on commit 1f2a76d

Please sign in to comment.