Sending logical replication data only after synchronous replication happened

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Sending logical replication data only after synchronous replication happened

Andrey Borodin-2

On PgCon 2020 we had been discussing some caveats of synchronous replication [0] related to data durability in HA postgres installations.

But also there was raised important concern about streaming logical replication only after it "actually happened" for HA cluster.
Is anyone working on it?If no, I propose to discuss design of this feature.

Why is it important? It's important for changed data capture (CDC).
For physical replication we can apply changed forward (just replay WAL) and backward (with help of pg_rewind).
But there is no clean way to undo logical replication.

Consider someone having a data publication from HA cluster A to another postgres installation B. A consists of primary A1 and standby A2.

When failover happens from A1 to A2 some part of A1 history can be committed locally on A. And streamed to B via logical replication. After failover to A2 B cannot continue CDC from A2 because B already applied part of a history from A1 which never existed for A2.

During unconference session [0] there was proposed GUC that is 'post_synchronous_standby_names' of standbys that can't get data until the transaction has been sent to the sync standbys.
This will do the trick, though I'm not sure It's best possible interface for the feature.
Any ideas on the feature will be appreciated.


Best regards, Andrey Borodin.