canonical / postgresql-k8s-operator

A Charmed Operator for running PostgreSQL on Kubernetes
https://charmhub.io/postgresql-k8s
Apache License 2.0
10 stars 20 forks source link

WAL archiving disables after leader changes #614

Closed Zvirovyi closed 2 weeks ago

Zvirovyi commented 3 months ago

This is the same bug I've encountered in VM version of this charm.

Steps to reproduce

  1. juju deploy s3-integrator and configure it
  2. juju deploy postgresql-k8s --config profile=testing --channel edge --trust -n 4
  3. juju integrate s3-integrator postgresql-k8s
  4. juju ssh --container postgresql postgresql-k8s/0 cat /var/lib/postgresql/data/patroni.yml | grep archive For each unit, it will show archive_command: 'pgbackrest --stanza=dev.patroni-postgresql-k8s archive-push %p' Screenshot
  5. juju scale-application postgresql-k8s 2 (leader and primary changes)
  6. Wait until cluster stabilizes
  7. Do the step 4, but now see archive_command: /bin/true in the output for each unit Screenshot

Expected behavior

Archiving is still enabled after leader changes.

Actual behavior

Archiving is disables after leader changes.

Versions

Operating system: Ubuntu 24.04 LTS

Juju CLI: 3.5.3-genericlinux-amd64

Juju agent: 3.5.3

Charm revision: 347

microk8s: MicroK8s v1.30.1 revision 6843

Log output

Juju debug log: debug-log

Additional context

This is related to the leader change or peer relation changed events, i think, because when i do the same test, but instead of removing 2 units (including leader / primary) i just use curl -X POST -d '{"leader": "postgresql-k8s-0", "candidate": "postgresql-k8s-1"}' -H "Content-Type: application/json" http://localhost:8008/switchover (snippet from the integration tests), all the units remain archiving enabled.

github-actions[bot] commented 3 months ago

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