Sending logical replication data only after synchronous replication happened - Mailing list pgsql-hackers

From Andrey Borodin
Subject Sending logical replication data only after synchronous replication happened
Date
Msg-id 03D4D460-A5F9-4AC8-B4BA-B0290671BCD6@yandex-team.ru
Whole thread Raw
List pgsql-hackers
Hi!

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

But also there was raised important concern about streaming logical replication only after it "actually happened" for
HAcluster. 
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
A1and 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
logicalreplication. After failover to A2 B cannot continue CDC from A2 because B already applied part of a history from
A1which never existed for A2. 

During unconference session [0] there was proposed GUC that is 'post_synchronous_standby_names' of standbys that can't
getdata 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.

Thanks!


Best regards, Andrey Borodin.


[0]
https://wiki.postgresql.org/wiki/PgCon_2020_Developer_Unconference/Edge_cases_of_synchronous_replication_in_HA_solutions


pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Re: Parallel Inserts in CREATE TABLE AS
Next
From: Ashutosh Bapat
Date:
Subject: Enumize logical replication message actions