diff --git a/internal/querynodev2/cluster/worker.go b/internal/querynodev2/cluster/worker.go index af2bc7a215e96..9261dac91089d 100644 --- a/internal/querynodev2/cluster/worker.go +++ b/internal/querynodev2/cluster/worker.go @@ -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 } diff --git a/internal/querynodev2/cluster/worker_test.go b/internal/querynodev2/cluster/worker_test.go index 358ec2b5af5ab..55c0e97f1cf48 100644 --- a/internal/querynodev2/cluster/worker_test.go +++ b/internal/querynodev2/cluster/worker_test.go @@ -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() {