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

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Petr Jelinek <petr.jelinek@2ndquadrant.com>
Cc: Simon Riggs <simon@2ndquadrant.com>, Magnus Hagander <magnus@hagander.net>, Postgres hackers <pgsql-hackers@postgresql.org>
Date: 2018-06-07T00:42:41Z
Lists: pgsql-hackers
On Wed, Jun 06, 2018 at 04:57:22PM +0200, Petr Jelinek wrote:
> I think the only thing to note about the patches from my side is that we
> probably don't want to default to restart_lsn for the
> pg_logical_replication_slot_advance() return value (when nothing was
> done) but rather the confirmed_lsn. As it is in current patch if we call
> the function repeatedly and one call moved slot forward but the next one
> didn't the return value will go backwards as restart_lsn tends to be
> behind the confirmed one.

It does not matter much as the PG_TRY loop would still enforce the
result to confirmed_lsn anyway if nothing happens, still let's do as you
suggest as that's more consistent.
--
Michael

Commits

  1. Fix a couple of bugs with replication slot advancing feature

  2. Fix and document lock handling for in-memory replication slot data