stolon icon indicating copy to clipboard operation
stolon copied to clipboard

Maintain cluster-wide logical replication slots in SynchronousReplication mode

Open ivlcic opened this issue 4 years ago • 3 comments

What would you like to be added: Maintaining an online logical replication slots state for SynchronousReplication so the logical replication could switch-over when standby is promoted.

Why is this needed: This is needed for logical replication external to Stolon cluster. For instance: Data warehousing solution with Stolon cluster Hot data -> Logical rep. -> PostgreSQL Cold data)

Naive proposal Some double checking must me done since I'm no sure this is possible. Maybe one solution would be creating logical repl. slot on all servers with periodically calling pg_replication_slot_advance
on standbys reading master's replication slot state (taken in consideration that SynchronousReplication must be enabled - no lag on standbys).

It might be that its impossible to make it correctly: Logical replication and physical standby failover

ivlcic avatar Jan 19 '21 09:01 ivlcic

Yes, your proposed solution is also what Patroni does. And what EFM does as well. If we want it in Stolon, maybe I can issue a PR for it.

sebasmannem avatar Feb 11 '22 23:02 sebasmannem

That would be great. My knowledge of PostgreSQL and Stolon internals is insufficient to do it.

ivlcic avatar Feb 12 '22 05:02 ivlcic

Some relevant information on how Patroni is doing this

https://www.postgresql.eu/events/pgconfde2022/sessions/session/3745/slides/306/Implementing%20failover%20of%20logical%20replication%20slots%20in%20Patroni.pdf

Ondrysak avatar Nov 16 '22 14:11 Ondrysak