Synchronizing slots from primary to standby

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Synchronizing slots from primary to standby
Date: 2021-10-31 10:08:18
Message-ID: 514f6f2f-6833-4539-39f1-96cd1e011f23@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I want to reactivate $subject. I took Petr Jelinek's patch from [0],
rebased it, added a bit of testing. It basically works, but as
mentioned in [0], there are various issues to work out.

The idea is that the standby runs a background worker to periodically
fetch replication slot information from the primary. On failover, a
logical subscriber would then ideally find up-to-date replication slots
on the new publisher and can just continue normally.

The previous thread didn't have a lot of discussion, but I have gathered
from off-line conversations that there is a wider agreement on this
approach. So the next steps would be to make it more robust and
configurable and documented. As I said, I added a small test case to
show that it works at all, but I think a lot more tests should be added.
I have also found that this breaks some seemingly unrelated tests in
the recovery test suite. I have disabled these here. I'm not sure if
the patch actually breaks anything or if these are just differences in
timing or implementation dependencies. This patch adds a LIST_SLOTS
replication command, but I think this could be replaced with just a
SELECT FROM pg_replication_slots query now. (This patch is originally
older than when you could run SELECT queries over the replication protocol.)

So, again, this isn't anywhere near ready, but there is already a lot
here to gather feedback about how it works, how it should work, how to
configure it, and how it fits into an overall replication and HA
architecture.

[0]:
https://www.postgresql.org/message-id/flat/3095349b-44d4-bf11-1b33-7eefb585d578%402ndquadrant.com

Attachment Content-Type Size
v1-0001-Synchronize-logical-replication-slots-from-primar.patch text/plain 44.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2021-10-31 13:36:07 emit recovery stats via a new file or a new hook
Previous Message Etsuro Fujita 2021-10-31 09:05:44 postgres_fdw: commit remote (sub)transactions in parallel during pre-commit