Handle legacy querynode `Delete` Unimplemented (#27749)

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/27752/head
congqixia 2023-10-17 19:06:06 +08:00 committed by GitHub
parent 2f16339aac
commit 1f2a76d04d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 10 deletions

View File

@ -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
}

View File

@ -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() {