Skip to content

Comments

feat: use proper gRPC status codes for WAL errors#6

Closed
ermakov-oleg wants to merge 1 commit intomainfrom
feat/grpc-error-codes
Closed

feat: use proper gRPC status codes for WAL errors#6
ermakov-oleg wants to merge 1 commit intomainfrom
feat/grpc-error-codes

Conversation

@ermakov-oleg
Copy link
Owner

@ermakov-oleg ermakov-oleg commented Feb 13, 2026

Summary

Port of upstream #549

Problem: The plugin returned generic gRPC errors (wrapping errors.New()) for cases that have well-defined semantics. The CNPG operator could not distinguish a missing WAL (expected during restore) from a real error, and treated S3 permission errors the same as infrastructure failures.

Fix: Replaced custom error types with proper gRPC status codes:

  • codes.NotFound — WAL file not found in object store (replaces custom walNotFoundError type)
  • codes.OutOfRange — end of WAL stream reached during restore (was errors.New)
  • codes.FailedPrecondition — backup credentials don't have required S3 permissions yet (was errors.New)

This allows the CNPG operator to handle each case appropriately: retry on FailedPrecondition, stop on OutOfRange, skip on NotFound.

Port of upstream PR cloudnative-pg#549. WAL not found returns NotFound, end of WAL
stream returns OutOfRange, missing permissions returns FailedPrecondition.

Signed-off-by: ermakov-oleg <ermakovolegs@gmail.com>
@ermakov-oleg
Copy link
Owner Author

Submitted to upstream: operasoftware/cnpg-plugin-pgbackrest

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant