Is it safe to transfer logical replication publication/subscription?

From: Mike Lissner <mlissner(at)michaeljaylissner(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Is it safe to transfer logical replication publication/subscription?
Date: 2020-01-08 21:22:38
Message-ID: CAMp9=EwMa=LVtFhFZeYUyO7EzLLKiy3A6vA5tG-pyBq4S52QFw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all, this is a follow up from an earlier question I asked about
shortening a chain of logically replicating servers. Right now we have
three servers replicating like this:

A --> B --> C

And we want to remove B so that we have:

A --> C

Is it possible to DROP the subscription on B to A and then to
SUBSCRIBE C to the previously used publication on A without losing
data?

E.g., assuming the following:

- "A" has a PUBLICATION named "A-to-B-Pub" that "B" subscribes to.
- "C" subscribes to "B" with a subscription named "B-to-C-Sub".

Would this work?

1. On B, DROP the subscription to "A-to-B-Pub".

2. Let any cached changes on B flush to C. Give it an hour to be sure.

3. On C ALTER "B-to-C-Sub" to subscribe to the now-used "A-to-B-Pub" on A.

Seems like this would either work perfectly or totally fail. Any ideas?

Thanks for any help,

Mike

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2020-01-08 22:46:46 Re: Is it safe to transfer logical replication publication/subscription?
Previous Message Mike Lissner 2020-01-08 20:37:36 Re: How to shorten a chain of logically replicated servers