Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
Only verify backup stanza when running as a primary
Browse files Browse the repository at this point in the history
The check command of pgBackRest used to succeed on the replica, but this
behaviour changed recently [1] and will be ok in the long term.

This commit is a workaround for this change, and will only check the
backup stanza when running as primary.

Addresses issues #83 and #93

1: pgbackrest/pgbackrest#878
  • Loading branch information
feikesteenbergen committed Jan 21, 2020
1 parent f154025 commit be50aa8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions charts/timescaledb-single/templates/configmap-scripts.yaml
Expand Up @@ -47,10 +47,13 @@ data:
sleep 3
done
pgbackrest check || {
log "Creating pgBackrest stanza"
pgbackrest --stanza=poddb stanza-create --log-level-stderr=info || exit 1
}
# If we are the primary, we want to create/validate the backup stanza
if [ "$(psql -c "SELECT pg_is_in_recovery()::text" -AtXq)" == "false" ]; then
pgbackrest check || {
log "Creating pgBackrest stanza"
pgbackrest --stanza=poddb stanza-create --log-level-stderr=info || exit 1
}
fi
log "Starting pgBackrest api to listen for backup requests"
exec python3 /scripts/pgbackrest-rest.py --stanza=poddb --loglevel=debug
Expand Down

0 comments on commit be50aa8

Please sign in to comment.