Re: Logical replication in the same cluster

From: Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Logical replication in the same cluster
Date: 2017-05-02 07:17:27
Message-ID: dcb5e17f-d5f7-9220-c4f9-2f9bf464a2a3@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 02/05/17 04:14, Peter Eisentraut wrote:
> On 4/30/17 20:31, Andres Freund wrote:
>> On 2017-04-26 23:41:51 +0200, Petr Jelinek wrote:
>>> Yes that's result of how logical replication slots work, the transaction
>>> that needs to finish is your transaction. It can be worked around by
>>> creating the slot manually via the SQL interface for example and create
>>> the subscription using WITH (NOCREATE SLOT, SLOT NAME = 'your slot') .
>>
>> Is there any chance the creation of the slot could be moved ahead, to
>> before an xid has been assigned?
>
> The trend has rather been to do most of the stuff before creating the
> slot, so that all the error checking is done. See for example
> dcb39c37c1d3b90115e1501af8efb7af59c341c3.
>

Yes because otherwise we risk leaving slot on the upstream if the
command fails downstream. We could move the slot creation outside of tx
as I proposed, then we risk leaving subscription downstream without slot
upstream though but I think that's less of a issues from user
friendliness and mainly safety (slot reserves wal and global catalog
xmin while subscription does not reserve anything except the name of the
subscription).

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vladimir Borodin 2017-05-02 07:25:27 Re: [PROPOSAL] Use SnapshotAny in get_actual_variable_range
Previous Message Petr Jelinek 2017-05-02 07:11:40 Re: logical replication and PANIC during shutdown checkpoint in publisher