-
Notifications
You must be signed in to change notification settings - Fork 26
[DPE-2953] Cross-region async replication #452
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
taurus-forever
approved these changes
Apr 26, 2024
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.
LGTM, but one critical question about patroni.yaml perms.
delgod
reviewed
Apr 26, 2024
…ation Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
…ation Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
dragomirp
approved these changes
May 2, 2024
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
It's not possible to replicate data between regions.
Solution
Implement cross-region async replication. This PR is a rebranded and more stable version of #317.
With this PR, it's no longer necessary to remove the relation and relate again when a switchover is needed.
Also, the names of the relations can easily be changed to others, like
cluster-one
andcluster-two
, for example, to avoid confusing users.This is mostly a copy and paste from canonical/postgresql-k8s-operator#447.
Important changes:
src/relations/async_replication.py
contains the logic to make one cluster the primary and the other the standby. To make the standby cluster follow the primary cluster, the candidate for the standby cluster needs to be restarted.The most important part of the logic is handled by the
_on_async_relation_changed
, which takes care of restarting the standby cluster units databases in order to make them replicate data from the primary cluster.Additionally to everything implemented on [DPE-2897] Cross-region async replication postgresql-k8s-operator#447, this PR adds the coordination of which RAFT members should be part of the Patroni internal RAFT cluster while starting the units in the standby cluster. It's done through the return value from the
get_partner_addresses
method.Passwords update will be implemented in another PR, as this one is already huge.
If the standby cluster has its relation removed, it goes to a
read-only mode
and can be promoted later to a normal cluster through thepromote-cluster
action.How to deploy: https://discourse.charmhub.io/t/charmed-postgresql-deploy-async-replication/13991
How to trigger a switchover: https://discourse.charmhub.io/t/charmed-postgresql-async-switchover/13993
Additional instructions:
Integration tests: #453