pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Dimitri Maziuk <dmaziuk@bmrb.wisc.edu>
To: pgsql-general@lists.postgresql.org
Subject: Re: logical replication snapshots
Date: Thu, 26 Jul 2018 17:11:14 -0700
Message-ID: <bf2947f7-9528-2f42-7130-b84bcfa9b249@aklaver.com> (raw)
In-Reply-To: <1542cf6a-151d-24b6-afc2-b4cee0ae1aa1@bmrb.wisc.edu>
References: <20180724172115.ztthbxmfgucnuuq3@alvherre.pgsql>
	<f1fe2e11-c298-0383-5df2-e0dbb2a9a68b@bmrb.wisc.edu>
	<20180724184337.k6nq7k3cq7xoorjn@alap3.anarazel.de>
	<04dcfd2d-6201-09e7-4209-9894d669f694@bmrb.wisc.edu>
	<20180725152827.g22qmue3wgycifjh@alap3.anarazel.de>
	<9b9a72f4-44c8-5e78-8814-fdc39ca3a3ad@bmrb.wisc.edu>
	<cade60b5-cdc5-a9ed-68b8-173f394a9ce5@aklaver.com>
	<a1b9701e-5249-2a61-6a37-f8f02c3fe707@bmrb.wisc.edu>
	<1c539619-7b72-3669-81cd-2a55352b1008@aklaver.com>
	<20180726005706.gzinfqg7mjfnsf6g@alap3.anarazel.de>
	<c04c0920-4085-8647-dc03-aae453bb2aa9@bmrb.wisc.edu>
	<10933bb0-5a3b-4ed2-fc6c-2a712510ef9b@aklaver.com>
	<00acc822-e5d6-b9ad-43a9-e989d8581ae7@bmrb.wisc.edu>
	<40f0b879-2b5b-05ad-57ba-3688510be87d@aklaver.com>
	<fbe173fd-7780-a691-5ec5-f5173c5e5c57@bmrb.wisc.edu>
	<93e99c67-cdc5-e776-2a00-3ba090e2c4c4@aklaver.com>
	<1542cf6a-151d-24b6-afc2-b4cee0ae1aa1@bmrb.wisc.edu>

On 07/26/2018 04:48 PM, Dimitri Maziuk wrote:
> On 07/26/2018 05:34 PM, Adrian Klaver wrote:
>> On 07/26/2018 03:01 PM, Dimitri Maziuk wrote:
> 
>>> Let me ask a different question: if I drop and re-create a published
>>> table on the publisher without doing anything to the publication and
>>> subscription, what happens?
>>
>> Take a look at:
>>
>> https://www.postgresql.org/docs/10/static/sql-alterpublication.html
> 
> Thanks but what I ask (and what I suspect happened here while I wasn't
> looking) is
> 
> - create schema foo with tables bar and baz and some rows in 'em
> - create publication foopub with foo.bar and foo.baz
> - create subscription to foopub on the other node, initial sync and all
> - drop schema foo on the publisher
> - create schema foo with tables bar and baz and some rows in 'em
> 
> The publication foopub is at this point fubar I take it? And needs to be
> re-created on the publisher and reconnected on the subscriber? Complete
> with with inital resync?

Not sure. Personally I would try:

1) ALTER PUBLICATION DROP TABLE foo|bar;

2) ALTER PUBLICATION ADD TABLE foo|bar;

3) ALTER SUBSCRIPTION sub_name REFRESH PUBLICATION

If you get to 3) it will re-sync the data unless you tell it otherwise.

The above is probably dependent on the size of the publication. If you 
did a publication for ALL it would make more sense to do the above then 
if you did a publication for just foo or bar.



-- 
Adrian Klaver
adrian.klaver@aklaver.com




view thread (27+ messages)  latest in thread

Message-ID: <bf2947f7-9528-2f42-7130-b84bcfa9b249@aklaver.com>
Permalink:  ../bf2947f7-9528-2f42-7130-b84bcfa9b249@aklaver.com/
Also on:    postgresql.org/message-id/bf2947f7-9528-2f42-7130-b84bcfa9b249@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, dmaziuk@bmrb.wisc.edu
  Subject: Re: logical replication snapshots
  In-Reply-To: <bf2947f7-9528-2f42-7130-b84bcfa9b249@aklaver.com>
  References: <20180724172115.ztthbxmfgucnuuq3@alvherre.pgsql> <f1fe2e11-c298-0383-5df2-e0dbb2a9a68b@bmrb.wisc.edu> <20180724184337.k6nq7k3cq7xoorjn@alap3.anarazel.de> <04dcfd2d-6201-09e7-4209-9894d669f694@bmrb.wisc.edu> <20180725152827.g22qmue3wgycifjh@alap3.anarazel.de> <9b9a72f4-44c8-5e78-8814-fdc39ca3a3ad@bmrb.wisc.edu> <cade60b5-cdc5-a9ed-68b8-173f394a9ce5@aklaver.com> <a1b9701e-5249-2a61-6a37-f8f02c3fe707@bmrb.wisc.edu> <1c539619-7b72-3669-81cd-2a55352b1008@aklaver.com> <20180726005706.gzinfqg7mjfnsf6g@alap3.anarazel.de> <c04c0920-4085-8647-dc03-aae453bb2aa9@bmrb.wisc.edu> <10933bb0-5a3b-4ed2-fc6c-2a712510ef9b@aklaver.com> <00acc822-e5d6-b9ad-43a9-e989d8581ae7@bmrb.wisc.edu> <40f0b879-2b5b-05ad-57ba-3688510be87d@aklaver.com> <fbe173fd-7780-a691-5ec5-f5173c5e5c57@bmrb.wisc.edu> <93e99c67-cdc5-e776-2a00-3ba090e2c4c4@aklaver.com> <1542cf6a-151d-24b6-afc2-b4cee0ae1aa1@bmrb.wisc.edu> <bf2947f7-9528-2f42-7130-b84bcfa9b249@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox