Is it safe to transfer logical replication publication/subscription?

Mike Lissner <[email protected]> Wed, 8 Jan 2020 13:22:38 -0800
Newsgroups gmane.comp.db.postgresql.general
Message-ID <CAMp9=EwMa=LVtFhFZeYUyO7EzLLKiy3A6vA5tG-pyBq4S52QFw@mail.gmail.com>
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