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

AutoFailover downfalls and improvements

Open Conor-Quin opened this issue 7 years ago • 12 comments

What is the motivation or use case for the change?

We are planning to use the operator as part of our applications deployment. It is critical that our application has high availability and reliability but the auto-failover feature that is currently in place does not provide this.

The following are some scenarios that are not supported:

When there is a problem with the PVC underneath the primary cluster:

Test that was done: I removed the PVC from the primary cluster What happened: Nothing. The primary cluster remained the same What was expected: Promote one of the replica clusters that had a PVC to primary

When there is a problem with the worker underneath the primary cluster:

Test that was done: I removed the worker node the primary cluster was running on What happened: Nothing. The primary cluster remained the same What was expected: Promote one of the replica clusters that was running on a worker that was still available to primary

Additional scenarios will be added if/when found

Describe the solution you'd like Mentioned in the "what was expected"

Please tell us about your environment:

  • Operating System:
  • Where is this running ( Local, Cloud Provider): Cloud Provider
  • Storage being used (NFS, Hostpath, Gluster, etc):
  • Container Image Tag: centos7-4.0.0
  • PostgreSQL Version: 4.0.0
  • Platform (Docker, Kubernetes, OpenShift): Kubernetes
  • Platform Version: 1.13

Additional context failoverEnabled.txt

Conor-Quin avatar Jul 25 '19 12:07 Conor-Quin

thanks, noted and will work on an implementation.

jmccormick2001 avatar Jul 25 '19 13:07 jmccormick2001

for my testing, could you provide the storage type (gce? ebs?) and also the command you used to delete the PVC? I'll give this a try today.

jmccormick2001 avatar Jul 29 '19 13:07 jmccormick2001

The environment was using IBM Block Storage.

The command used to remove the PVC kubectl delete pvc <name-of-pvc>

Sidenote: The finalizers needed to be removed from the PVC to allow for it's deletion

Conor-Quin avatar Jul 29 '19 13:07 Conor-Quin

@jmccormick2001 It also must be added that Rook-ceph is also used in some of our environments too.

It's not strictly IBM block storage

Conor-Quin avatar Jul 30 '19 10:07 Conor-Quin

some status...I did an initial test of killing the pvc/pv and the failover occurred...this was using storageos as the PV type and this was on k8s 1.15...the pod controller sees the not ready event and works as normal. I removed the finalizers from the pod/pvc/pv to get the PV to remove...I'll need to test this some more to see how to duplicate it. If you recreate it, I'd be curious to see your operator container log with debug turned on.

jmccormick2001 avatar Jul 30 '19 18:07 jmccormick2001

The pod does not go into a not ready state when the PVC is removed when I'm testing so the failover process will not work for me when I'm testing.

There doesn't seem to be any logs in the operator as the failover is not triggered as the pod doesn't go into the not ready state pvcRemove.txt

Conor-Quin avatar Jul 31 '19 12:07 Conor-Quin

thanks, one test that would be good to run is 'exec' into the primary pod after you remove the PVC, and see if you can run 'psql'. The probe is essentially doing that so I'd be curious of what happens if you run 'select now()' manually.

jmccormick2001 avatar Jul 31 '19 13:07 jmccormick2001

The queries can still run successfully even though Kubernetes is telling me that the PVC is removed.

Not sure how it's still working and storing data without the PVC underneath.

When that pod is restarted it does not come back as it can't claim the previously deleted PVC which can be seen in failoverEnabled.txt above ^^.

Maybe it mightn't be a problem if it stills stores data and works

Conor-Quin avatar Jul 31 '19 14:07 Conor-Quin

ok, that explains why the 'not ready' is not getting made...another test would be to see if you can insert/or create some data instead of just a 'select now()'....I've thought of making the probe also test for the existentence of "/pgdata/" using a 'ls /pgdata/somecluster', would also be curious if that errors out.

jmccormick2001 avatar Jul 31 '19 14:07 jmccormick2001

We tried creating a table and writing to it and it seems to work. /pgdata does seem to be getting written to so we are unsure why it is working.

writing.txt

Conor-Quin avatar Jul 31 '19 14:07 Conor-Quin

weird for sure, not sure how I can catch that in the probe at the moment..I might try this with rook/ceph and see how it responds...maybe its how the storage is implemented, not sure.

jmccormick2001 avatar Jul 31 '19 15:07 jmccormick2001

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 29 '19 16:09 stale[bot]