Skip to content

Conversation

@marceloneppel
Copy link
Member

@marceloneppel marceloneppel commented Dec 2, 2025

Issue

If pgBackRest cannot archive a WAL file in less than 60 seconds, it will fail it's check command and the charm will be stuck in a blocked status.

Solution

In the stanza check step, handle the error code 82 (Archive operation timeout) in the same way we already do for error code 49 (Cannot connect to host) in the stanza initialisation step:

if return_code == 49:
. This way, the user can fix the problem and run juju resolve.

Fixes #784

Tested manually by adding sleep 90 && before the actual archive command in templates/patroni.yml.j2 and deploying the charm + connecting it to Microceph's RadosGW.

pgBackRest error codes extracted from source code: error-codes.csv. I think we shouldn't turn the charm into an error state for every error code, so I'm limiting it to error code 82 for now. We may expand the list of error codes in which we do that in the charm in the future.

Also, sometimes the error message from pgBackRest is sent to stdout instead of stderr (and we don't log them, as seen in #1280), so it's important to check both. I ported the changes from #1320 to this PR to handle that situation.

Checklist

  • I have added or updated any relevant documentation.
  • I have cleaned any remaining cloud resources from my accounts.

Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
@github-actions github-actions bot added the Libraries: Out of sync The charm libs used are out-of-sync label Dec 2, 2025
@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

❌ Patch coverage is 84.61538% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.83%. Comparing base (6ffe0b4) to head (b6819f1).

Files with missing lines Patch % Lines
src/backups.py 84.61% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1328      +/-   ##
==========================================
+ Coverage   75.75%   75.83%   +0.07%     
==========================================
  Files          16       16              
  Lines        4187     4217      +30     
  Branches      633      640       +7     
==========================================
+ Hits         3172     3198      +26     
- Misses        793      796       +3     
- Partials      222      223       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@marceloneppel marceloneppel added the bug Something isn't working as expected label Dec 2, 2025
Sometimes the error message is sent to the stdout instead of the stderr, so it's important to check both

Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
@marceloneppel marceloneppel marked this pull request as ready for review December 3, 2025 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working as expected Libraries: Out of sync The charm libs used are out-of-sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Units stuck blocked with failed to initialize stanza, check your S3 settings

2 participants