Re: Copy function for logical replication slots

From: Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, 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-11-24 15:27:55
Message-ID: 5fb61eaf-f698-4c01-9dd7-ce4cb6d5a0f5@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 31/08/2018 07:03, Masahiko Sawada wrote:
>
> Attached a new version patch incorporated the all comments I got.
>

This looks pretty reasonable.

I am personally not big fan of the C wrappers for overloaded functions,
but that's what we need to do for opr_sanity to pass so I guess we'll
have to use them.

The more serious thing is:

> + if (MyReplicationSlot)
> + ReplicationSlotRelease();
> +
> + /* Release the saved slot if exist while preventing double releasing */
> + if (savedslot && savedslot != MyReplicationSlot)

This won't work as intended as the ReplicationSlotRelease() will set
MyReplicationSlot to NULL, you might need to set aside MyReplicationSlot
to yet another temp variable inside this function prior to releasing it.

--
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 Alvaro Herrera 2018-11-24 15:36:09 Re: [HACKERS] pgbench - allow to store select results into variables
Previous Message Christoph Berg 2018-11-24 14:38:45 Re: pgsql: Add WL_EXIT_ON_PM_DEATH pseudo-event.