Re: pg_replication_slot_advance to return NULL instead of 0/0 if slotnot advanced - Mailing list pgsql-hackers

From Petr Jelinek
Subject Re: pg_replication_slot_advance to return NULL instead of 0/0 if slotnot advanced
Date
Msg-id 73f4672f-f71a-37d7-a8dc-8e406e4b5728@2ndquadrant.com
Whole thread Raw
In response to Re: pg_replication_slot_advance to return NULL instead of 0/0 ifslot not advanced  (Michael Paquier <michael@paquier.xyz>)
Responses Re: pg_replication_slot_advance to return NULL instead of 0/0 ifslot not advanced
Re: pg_replication_slot_advance to return NULL instead of 0/0 ifslot not advanced
List 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


pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: plans for PostgreSQL 12
Next
From: tushar
Date:
Subject: Re: New committers announced at PGCon 2018