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

Reply via email to