zalando / zalando/postgres-operator
Connection poolers point to read-only replica after a fail-over
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 5.2k
- Forks
- 1.1k
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 3
Description
-
Which image of the operator are you using?
registry.opensource.zalan.do/acid/postgres-operator:v1.7.1 -
Where do you run it - cloud or metal? Kubernetes or OpenShift?
Bare Metal K8S -
Are you running Postgres Operator in production?
Yes -
Type of issue?
Bug report
We are encountering an issue where the connection poolers continue pointing to the old master Postgres replica after a fail-over. We think this is the sequence of events:
postgres-2was the leaderpostgres-2lost leader lock and started to demote itselfpostgres-poolerlost connection to postgres-2 and tried to reconnectpostgres-0got leader lock and started to promote itselfpostgres-2finished restarting before postgres-0postgres-poolerreconnected to postgres-2postgres-0finished promotingpatroniupdated K8S service IP to point to the endpoint ofpostgres-0, but it was too late sinceconnection-poolerhad already finish reconnectingpostgres-poolerwere now stucked with the read-onlypostgres-2untilserver_lifetimeelapsed
Does this make sense ?
Should postgres-operator issue a RECONNECT to command to all pooler after the service endpoint is update ?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported failover sequence involving postgres-pooler, Patroni, and the Kubernetes service endpoint. Check whether poolers can reconnect to the newly promoted postgres-0 instead of remaining on read-only postgres-2 until server_lifetime expires; done means poolers consistently target the writable leader after failover.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes, postgresql
- Domain
- databases, distributed-systems, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100