diff options
author | Quang-Minh Nguyen <qmnguyen@gitlab.com> | 2023-06-23 13:25:29 +0300 |
---|---|---|
committer | Quang-Minh Nguyen <qmnguyen@gitlab.com> | 2023-06-26 14:32:01 +0300 |
commit | 6ac87a72f42d764de827836a56c726e6d21ee96e (patch) | |
tree | 875ec19dd05cb879937f9b1f0efcaf0da4e9f607 /STYLE.md | |
parent | 907849bb6e32569c81e027af55e19f83a2bf4552 (diff) |
Remove ineligible usage of Unavailable status codes
This commit replaces all ineligible usage of the Unavailable status
code. That status code is now reserved for cases that clients are
encouraged to retry. The most suitable use cases for this status code is
in interceptors or network-related components such as load-balancing.
The official documentations differentiate the usage of status codes as
the following:
> (a) Use UNAVAILABLE if the client can retry just the failing call.
> (b) Use ABORTED if the client should retry at a higher level
> (c) Use FAILED_PRECONDITION if the client should not retry until the
system state has been explicitly fixed
Multiple places in the source code capture the error from sending a
streaming message and wrap it in an Unavailable code. This status code
may not be correct because it can raise other less common errors, such
as buffer overflow (ResourceExhausted), max message size exceeded
(ResourceExhausted), or encoding failure (Internal), etc. The handler
should wrap it in an Aborted code, for example.
Another typical misused pattern is wrapping spawned process exit code.
In many cases, if Gitaly can intercept the exit code or/and error from
stderr, it must have a precise error code (InvalidArgument, NotFound,
Internal). However, Git processes may exit with exit code 128 and
un-parseable stderr. We can intercept it as an operation was rejected
because the system is not in a state where it can be executed (resource
inaccessible, invalid refs, etc.). FailedPrecondition is the most
suitable choice.
Diffstat (limited to 'STYLE.md')
0 files changed, 0 insertions, 0 deletions