pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Alexander Korotkov <akorotkov@postgresql.org>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Implement pg_wal_replay_wait() stored procedure
Date: Thu, 26 Sep 2024 17:18:49 +0900
Message-ID: <ZvUY6bfTwB0GsyzP@paquier.xyz> (raw)
In-Reply-To: <E1sZwuz-002NPQ-Lc@gemulon.postgresql.org>
References: <E1sZwuz-002NPQ-Lc@gemulon.postgresql.org>

Hi Alexander,

On Fri, Aug 02, 2024 at 06:22:21PM +0000, Alexander Korotkov wrote:
> Implement pg_wal_replay_wait() stored procedure
> 
> pg_wal_replay_wait() is to be used on standby and specifies waiting for
> the specific WAL location to be replayed.  This option is useful when
> the user makes some data changes on primary and needs a guarantee to see
> these changes are on standby.
> 
> The queue of waiters is stored in the shared memory as an LSN-ordered pairing
> heap, where the waiter with the nearest LSN stays on the top.  During
> the replay of WAL, waiters whose LSNs have already been replayed are deleted
> from the shared memory pairing heap and woken up by setting their latches.
> 
> pg_wal_replay_wait() needs to wait without any snapshot held.  Otherwise,
> the snapshot could prevent the replay of WAL records, implying a kind of
> self-deadlock.  This is why it is only possible to implement
> pg_wal_replay_wait() as a procedure working without an active snapshot,
> not a function.
> 
> Catversion is bumped.

I've spotted that this patch uses an OID that should not be used
during the development cycle:
+{ oid => '111',
+  descr => 'wait for the target LSN to be replayed on standby with an optional timeout', 

Please use something in the 8000-9999 range, as required by
98eab30b93d5.

Thanks,
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (50+ messages)  latest in thread

Message-ID: <ZvUY6bfTwB0GsyzP@paquier.xyz>
Permalink:  ../ZvUY6bfTwB0GsyzP@paquier.xyz/
Also on:    postgresql.org/message-id/ZvUY6bfTwB0GsyzP@paquier.xyz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, akorotkov@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Implement pg_wal_replay_wait() stored procedure
  In-Reply-To: <ZvUY6bfTwB0GsyzP@paquier.xyz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox