Skip to content

fix: classify WAL restore errors with precise gRPC statuses#927

Open
leonardoce wants to merge 1 commit into
cloudnative-pg:mainfrom
leonardoce:transient-status
Open

fix: classify WAL restore errors with precise gRPC statuses#927
leonardoce wants to merge 1 commit into
cloudnative-pg:mainfrom
leonardoce:transient-status

Conversation

@leonardoce
Copy link
Copy Markdown
Contributor

Map each restorer sentinel to the gRPC status that best reflects whether the operator should retry:

  • ErrWALNotFound -> NotFound (terminal)
  • ErrInvalidWalName -> InvalidArgument (terminal)
  • ErrConnectivity -> Unavailable (retry)
  • ErrGeneric -> Unavailable (retry)
  • anything else -> Internal (terminal)

Previously every non-NotFound failure was returned verbatim, leaving the operator unable to tell transient blips apart from terminal conditions like a malformed WAL name.

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels May 27, 2026
Map each restorer sentinel to the gRPC status that best reflects whether
the operator should retry:

  - ErrWALNotFound      -> NotFound        (terminal)
  - ErrInvalidWalName   -> InvalidArgument (terminal)
  - ErrConnectivity     -> Unavailable     (retry)
  - ErrGeneric          -> Unavailable     (retry)
  - anything else       -> Internal        (terminal)

Previously every non-NotFound failure was returned verbatim, leaving the
operator unable to tell transient blips apart from terminal conditions
like a malformed WAL name.

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
@leonardoce leonardoce requested a review from a team as a code owner May 27, 2026 09:31
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels May 27, 2026
@leonardoce
Copy link
Copy Markdown
Contributor Author

This PR needs cloudnative-pg/barman-cloud#253

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant