Re: pg_replication_slot_advance to return NULL instead of 0/0 if slot not advanced
Petr Jelinek <petr.jelinek@2ndquadrant.com>
From: Petr Jelinek <petr.jelinek@2ndquadrant.com>
To: Michael Paquier <michael@paquier.xyz>, Simon Riggs <simon@2ndquadrant.com>
Cc: Magnus Hagander <magnus@hagander.net>,
Postgres hackers <pgsql-hackers@postgresql.org>
Date: 2018-06-04T09:51:35Z
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
Commits
-
Fix a couple of bugs with replication slot advancing feature
- f731cfa94c00 11.0 landed
-
Fix and document lock handling for in-memory replication slot data
- 9e149c847f39 11.0 landed