logical replication slot and publication alter

From: Jinhua Luo <luajit(dot)io(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: logical replication slot and publication alter
Date: 2019-07-01 11:12:45
Message-ID: CAAc9rOzcgE_1ZFtcU1p=zFRVmkaGcYZ-gLhknCpC+qrC975=1g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi All,

There is an interesting issue: I created one replication slot,
specifying pgouput plugin and one publication "foobar". The
publication "foobar" was set to tables "foo1, foo2".

The slot was left unread, while the tables foo1 and foo2 get changed.
Then, I alter the publication "foobar" to remove table "foo2" and
start logical replication.

The changes from foo2 still be sent from the slot!

Another try is even if I drop the publication "foobar", the slot still
find the original publication definition and send the changes without
problem.

I check the source codes, and I think it's due to the snapshot, when
pgoutput load the publication, it would use the catalog tuples from
the snapshot instead of current version, so even if the publication
get altered or get dropped, the original version is still there in the
snapshot.

Is it expected or it's a bug? Anyways, alter publication would not
affect the replication stream is unexpected.

Regards,
Jinhua Luo

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2019-07-01 11:16:30 Re: [HACKERS] advanced partition matching algorithm for partition-wise join
Previous Message Thomas Munro 2019-07-01 11:06:54 Re: Psql patch to show access methods info