Repository navigation
Description
Is there an existing issue already for this feature request/idea?
- I have searched for an existing issue, and could not find anything. I believe this is a new feature request to be evaluated.
What problem is this feature going to solve? Why should it be added?
Currently, we need to manually transition from replication to primary mode, by setting replica.enabled = true or viceversa.
We should enable users to define a distributed topology, for example in 2 or 3 regions, and coordinate the scheduled promotion of a given cluster at regular intervals. We should also account for circular configurations based on cascading replication.
Describe the solution you'd like
Consider the example in #3796, with the following changes.
In pg1:
replica:
primary: pg1
source: pg2
enabled: auto
# self: pg1 # this should be set by default to `metadata.name` (but overridable by users)In pg2:
replica:
primary: pg1
source: pg1
enabled: auto
# self: pg2 # same as aboveSimilarly to source, the primary option matches a key in the externalClusters section. This option defines which Cluster is defined to be the primary in the distributed PostgreSQL cluster, based on the topology specified in externalClusters.
When primary is set, enabled must be set to auto.
When primary and self match, the cluster is accepting write operations (is a primary), so replica is the equivalent of false. When primary and self don't match, the cluster is in recovery mode from its source, so replica is the equivalent of true.
IMPORTANT: The solution should work with our without streaming replication (so just by relying on WAL shipping if required).
Describe alternatives you've considered
We had thought about using the database to share the topology. We believe that instead we should leverage configuration and rely on the externalClusters section.
Additional context
We must cater for additional clusters. For example, there could be a pg3 cluster in a third region, with the following circular architecture based on cascading replication:
pg1 -> pg2 -> pg3 -
^ |
-------------------
Backport?
No
Are you willing to actively contribute to this feature?
No
Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
feat: add `.spec.replicaCluster.primary` field
feat: add `.spec.replicaCluster.primary` field
feat: add `.spec.replicaCluster.primary` field (#4388)