canonical / postgresql-operator

A Charmed Operator for running PostgreSQL on machines
https://charmhub.io/postgresql
Apache License 2.0
7 stars 17 forks source link

WAL archiving disables after primary changes #463

Open Zvirovyi opened 2 months ago

Zvirovyi commented 2 months ago

Steps to reproduce

  1. juju deploy s3-integrator, and configure it
  2. juju deploy postgresql --channel edge --config profile=testing -n 3
  3. juju integrate postgresql s3-integrator
  4. juju ssh postgresql/0 sudo cat /var/snap/charmed-postgresql/current/etc/patroni/patroni.yaml | grep archive For each unit, it will show archive_command: 'pgbackrest --config=/var/snap/charmed-postgresql/current/etc/pgbackrest/pgbackrest.conf --stanza=dev.postgresql archive-push %p'
  5. juju remove-unit postgresql/2 - but choose your primary
  6. Wait until cluster stabilizes
  7. Do the step 4, but now see archive_command: /bin/true in the output for each unit

Expected behavior

Archiving is still enabled after primary changes

Actual behavior

Archiving is disables after primary changes

Versions

Operating system: Ubuntu 23.10

Juju CLI: 3.4.2-genericlinux-amd64

Juju agent: 3.4.0

Charm revision: 405

LXD: 5.21.1 LTS

Log output

Juju debug log: log.txt

Additional context

I found that stanza is being erased from app_peer_data in _on_s3_credential_gone function, and this causes described issue.

github-actions[bot] commented 2 months ago

https://warthogs.atlassian.net/browse/DPE-4304

dragomirp commented 2 months ago

We most probably need to verify which units are receiving the event.

Zvirovyi commented 2 months ago

@dragomirp Only leader, that being removed, receives this event.

image