Re: pg_replication_slot_advance to return NULL instead of 0/0 if slot not advanced

From: Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>, Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Postgres hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_replication_slot_advance to return NULL instead of 0/0 if slot not advanced
Date: 2018-06-04 09:51:35
Message-ID: 73f4672f-f71a-37d7-a8dc-8e406e4b5728@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 01/06/18 21:13, Michael Paquier wrote:
> - startlsn = MyReplicationSlot->data.confirmed_flush;
> + if (OidIsValid(MyReplicationSlot->data.database))
> + startlsn = MyReplicationSlot->data.confirmed_flush;
> + else
> + startlsn = MyReplicationSlot->data.restart_lsn;
> +
> if (moveto < startlsn)
> {
> ReplicationSlotRelease();

This part looks correct for the checking that we are not moving
backwards. However, there is another existing issue with this code which
is that we are later using the confirmed_flush (via startlsn) as start
point of logical decoding (XLogReadRecord parameter in
pg_logical_replication_slot_advance) which is not correct. The
restart_lsn should be used for that. I think it would make sense to fix
that as part of this patch as well.

--
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 tushar 2018-06-04 11:41:34 Re: New committers announced at PGCon 2018
Previous Message Pavel Stehule 2018-06-04 09:17:03 Re: plans for PostgreSQL 12