Re: Copy function for logical replication slots

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Copy function for logical replication slots
Date: 2018-08-14 04:38:23
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers

On Thu, Jul 12, 2018 at 9:28 PM, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> On Mon, Jul 9, 2018 at 10:34 AM, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>> On Mon, Jul 09, 2018 at 10:06:00AM +0900, Masahiko Sawada wrote:
>>> I think that this patch might be splitted but I will be able to send
>>> an updated patch in the next week. As you suggestion this patch needs
>>> more careful thoughts. I'll move this patch to the next commit fest if
>>> I will not be able to sent it. Is that okay?
>> Fine by me. Thanks for the update.
> Attached new version of patch incorporated the all comments I got from
> Michael-san.
> To prevent the WAL segment file of restart_lsn of the origin slot from
> removal during creating the target slot, I've chosen a way to copy new
> one while holding the origin one. One problem to implement this way is
> that the current replication slot code doesn't allow us to do
> straightforwardly; the code assumes that the process creating a new
> slot is not holding another slot. So I've changed the copy functions
> so that it save temporarily MyReplicationSlot and then restore and
> release it after creation the target slot. To ensure that both the
> origin and target slot are released properly in failure cases I used
> PG_ENSURE_ERROR_CLEANUP(). That way, we can keep the code changes of
> the logical decoding at a minimum. I've thought that we can change the
> logical decoding code so that it can assumes that the process can have
> more than one slots at once but it seems overkill to me.
> Please review it.

The previous patch conflicts with the current HEAD. Attached updated
version patch.


Masahiko Sawada
NTT Open Source Software Center

Attachment Content-Type Size
v5-0001-Copy-function-for-logical-and-physical-replicatio.patch application/octet-stream 38.9 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2018-08-14 06:33:26 Re: Alter index rename concurrently to
Previous Message Masahiko Sawada 2018-08-14 01:00:49 Re: Upper limit arguments of pg_logical_slot_xxx_changes functions accept invalid values