zalando / zalando/postgres-operator

smaller 'numberOfInstances' plus 'rollingUpdate' will make the postgres pods not updated

Open
#2,440 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
5.2k
Forks
1.1k
Avg merge
2d 16h
Merged PRs (30d)
3

Description

Please, answer some short questions which should help us to understand your problem / question better?

  • Which image of the operator are you using? e.g. registry.opensource.zalan.do/acid/postgres-operator:v1.10.1
    registry.opensource.zalan.do/acid/postgres-operator:v1.10.0

  • Where do you run it - cloud or metal? Kubernetes or OpenShift? [AWS K8s | GCP ... | Bare Metal K8s]
    cloud. Kubernetes

  • Are you running Postgres Operator in production? [yes | no]
    No.

  • Type of issue? [Bug report, question, feature request, etc.]
    Bug report

Some general remarks when posting a bug report:

  • Please, check the operator, pod (Patroni) and postgresql logs first. When copy-pasting many log lines please do it in a separate GitHub gist together with your Postgres CRD and configuration manifest.
  • If you feel this issue might be more related to the Spilo docker image or Patroni, consider opening issues in the respective repos.

Hi,
When testing in our environment, we found if the 'Postgresql' is changed with a smaller 'numberOfInstances'(from 3 to 2) plus a change leading to 'rollingUpdate'(for example, podTerminationGracePeriodSeconds), the postgres pods will NOT be updated and the error like "could not sync statefulsets: could not recreate pods: could not recreate replica pod "XXXXXXXXX-2": could not delete pod: pods "XXXXXXXX-2" not found" will be popped up.

By some analysis, it seems after updating the statefulset, the number of pods has been 2. The pod 'XXXXXXXX-2' has been deleted then, but it's still in 'podsToRecreate'.
Then when the logic tries to recreate the pods, it can't find the pod of 'XXXXXXXX-2'. Thus the "updating pods" can't continue.

We think it should be a bug in the Operator.
Thanks.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the change from three to two instances while triggering a rolling update, then inspect the StatefulSet synchronization path and its podsToRecreate handling. Done means the removed replica is not retried and the remaining PostgreSQL pods complete their update without the reported not-found error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes, postgresql
Domain
databases, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.