-
Notifications
You must be signed in to change notification settings - Fork 940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support standby replication from GS (GCS) #1446
Conversation
Thanks @jamesmcdonald. Why would you need the version. Yes, since Spilo 13, it's part of the WAL path, but then you would have it |
Thanks for the review! As I understand, PGVERSION gets added to the bucket path here: https://github.com/zalando/spilo/blob/master/postgres-appliance/scripts/configure_spilo.py#L763 after it's set from STANDBY_PGVERSION by https://github.com/zalando/spilo/blob/master/postgres-appliance/scripts/configure_spilo.py#L1027. |
No, |
Right, I see what you mean. That certainly makes sense given that you can only create a standby from the same version. Unfortunately the main I guess doing this properly would require additional logic in Spilo to either:
I've updated my branch to remove the version setting and demonstrate this behaviour; there's another branch https://github.com/jamesmcdonald/postgres-operator/tree/gs-standby-version with the previous commit. Do you have a suggestion for the best way to proceed? |
I've removed the ability to select a path via cluster/uid/version entirely because it doesn't work reliably. It's pretty straightforward to use the s3/gs_wal_path options. |
Picking up the version doesn't work reliably without making changes to Spilo. It's clearer to just specify the full S3/GS bucket path.
// standby with S3, find out the bucket to setup standby | ||
msg := "Standby from S3 bucket using custom parsed S3WalPath from the manifest %s " | ||
c.logger.Infof(msg, description.S3WalPath) | ||
if description.S3WalPath != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if description.S3WalPath != "" { | |
if description.S3WalPath == "" && description.GSWalPath == "" { | |
return nil | |
} | |
if description.S3WalPath != "" { |
We should still consider the case when either one of the WAL paths is empty and return nil to have the same behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, fixed!
pkg/apis/acid.zalan.do/v1/crds.go
Outdated
"cluster": { | ||
Type: "string", | ||
}, | ||
"uid": { | ||
Type: "string", | ||
Format: "uuid", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can go, I think. Maybe a left over from an earlier version of this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleaned these up too.
@jamesmcdonald can you have a look at my two comments? I think after that we can merge this PR :) |
👍 |
1 similar comment
👍 |
This allows standby clusters to be created from a GCS bucket by specifying either
gs_wal_path
with a full manual path, orcluster
and optionallyuid
andversion
for similar behaviour to cloning. I've updated the documentation with the details. I have tested it against a number of GCS WAL-G backups and it seems to work nicely. I haven't tested the cluster-based replication from S3 as I don't have any data in S3 to try it out with.It uses the main
GCPCredentials
from the operator config rather than requiring a standby-specific setting which I think should generally work. If different credentials are needed for pushing WALs then they can be changed at the same time as the standby is promoted.I created this before I realised there was an existing PR! Let me know if it's useful. This is going to be an essential feature for us so I'm happy to amend it as needed.