12epartur3 commented on issue #1986:
URL: 
https://github.com/apache/incubator-brpc/issues/1986#issuecomment-1314676987

   > > 看代码应该是没有Trailers-Only相关的逻辑
   > 
   > 想问下,在brpc client场景中server返回的哪些错误码会进行重试呢?我了解的到`ELIMIT`限流时会进行重试,还有别的情况吗?
   
   grpc客户端可以配置对应的错误码,遇到对应错误码可以重试
   `{
           "loadBalancingConfig": [
               {
                   "round_robin": {}
               }
           ],
           "retryThrottling": {
               "maxTokens": 10,
               "tokenRatio": 1
           },
           "methodConfig": [
               {
                   "name": [
                       {
                           "service": "my_service,
                           "method": "my_method"
                       }
                   ],
                   "retryPolicy": {
                       "MaxAttempts": 2,
                       "InitialBackoff": "0.001s",
                       "MaxBackoff": "0.001s",
                       "BackoffMultiplier": 1.0,
                       "RetryableStatusCodes": [
                           "UNAVAILABLE",
                           "RESOURCE_EXHAUSTED"
                       ]
                   },
                   "waitForReady": true
               }
           ]
       }`
   
参考:https://github.com/grpc/grpc-go/tree/f51d21267df53c7f4e3533e18fdf5b61c76e005d/examples/features/retry
   brpc服务器中模拟error,cntl->SetFailed(brpc::ELOGOFF, "test ELOGOFF”);
   在grpc的客户端中配置对应错误码 
UNAVAILABLE(ELIMIT对应grpc错误码RESOURCE_EXHAUSTED),发现没有进行重试,后续看到是grpc-go的shouldRetry函数中,判断if
 !a.s.TrailersOnly()提前退出了。
   看grpc的文档貌似应该将错误码返回在TrailersOnly的帧里面,但是brpc返回错误码是带了header。
   Most responses are expected to have both headers and trailers but 
Trailers-Only is permitted for calls that produce an immediate error.
   参考:https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to