Skip to content

Logical replication (Publication and Subscription CRD) #13

@gbartolini

Description

@gbartolini

Declarative way to publish changes to one or more tables using logical replication (publications), as well as to subscribe to any Postgres 10+ publication (subscriptions) and consume those events.

  • [split from #13] plugin command to set up all the objects needed for logical replication

POC: #5329

The POC assumes the Database CRD/controller are there already.
Like the Database code, the ObservedGeneration field in the Status allows skipping reconciliation if there’s nothing new.
Like the Database code, there is a ReclaimPolicy field determining whether objects are deleted or retained for End-of-life

API’s:

apiVersion: postgresql.cnpg.io/v1
 kind: Publication
 metadata:
   name: publication-sample
 spec:
   name: pub
   dbname: app
   cluster:
     name: cluster-example
   target:
     allTables: {}
apiVersion: postgresql.cnpg.io/v1
 kind: Subscription
 metadata:
   name: subscription-sample
 spec:
   name: sub
   dbname: app
   publicationName: pub
   cluster:
     name: cluster-example-dest
   externalClusterName: cluster-example

Questions

Do we want to detect changes on the side of Postgres? At the moment we use the ObservedGeneration to decide if we may skip reconciliation. Changes made within Postgres are ignored, then

^ the consensus about the above question is not to look for changes on the side of Postgres

References

https://www.postgresql.org/docs/current/sql-createpublication.html
https://www.postgresql.org/docs/current/sql-alterpublication.html
https://www.postgresql.org/docs/current/sql-createsubscription.html
https://www.postgresql.org/docs/current/sql-altersubscription.html

Metadata

Metadata

Labels

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions