postgres-operator icon indicating copy to clipboard operation
postgres-operator copied to clipboard

Running switchover before leader shutdown

Open dooman87 opened this issue 1 year ago • 0 comments

Have an idea to improve PGO? We'd love to hear it! We're going to need some information from you to learn more about your feature requests.

Please be sure you've done the following:

  • [x] Provide a concise description of your feature request.
  • [x] Describe your use case. Detail the problem you are trying to solve.
  • [x] Describe how you envision that the feature would work.
  • [x] Provide general information about your current PGO environment.

Overview

When the pod with a leader is terminating - run patroni switchover to minimize downtime.

Use Case

Operator version: 5.6

We are currently deploying our PostgresCluster with two replicas. Every replica is running on its own node. Our EKS cluster ran by the other team and they need to update nodes which is causing pods eviction and re-creation. When leader pod is terminated, then patroni will schedule failover and most of the time it will cause 2-4 seconds downtime, but sometime that downtime could take up to 20 seconds.

Desired Behavior

We are currently developing a sidecar that can run a preStop hook that will execute switchover if it's a leader.

Could that be a default behavior and preStop hook included into postgres container?

Environment

Tell us about your environment:

Please provide the following details:

  • EKS
  • Platform Version: (e.g. 1.20.3, 4.7.0)
  • PGO Image Tag: 5.6.0
  • Postgres Version 15
  • Storage: ebs
  • Number of Postgres clusters: 1

Additional Information

Would be curious to know if that's been considered before and the approach has any disadvantages?

dooman87 avatar Oct 31 '24 01:10 dooman87