From: Alexander Korotkov <akorotkov@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Adjust pg_wal_replay_wait() procedure behavior on promoted stand
Date: Sat, 10 Aug 2024 18:43:36 +0000
Message-ID: <E1scr3w-003bVZ-AQ@gemulon.postgresql.org> (raw)
Adjust pg_wal_replay_wait() procedure behavior on promoted standby
pg_wal_replay_wait() is intended to be called on standby. However, standby
can be promoted to primary at any moment, even concurrently with the
pg_wal_replay_wait() call. If recovery is not currently in progress
that doesn't mean the wait was unsuccessful. Thus, we always need to recheck
if the target LSN is replayed.
Reported-by: Kevin Hale Boyes
Discussion: https://postgr.es/m/CAPpHfdu5QN%2BZGACS%2B7foxmr8_nekgA2PA%2B-G3BuOUrdBLBFb6Q%40mail.gmail.com
Author: Alexander Korotkov
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/867d396ccd2a7f0ce55e1fa7ebda00bc8c81147b
Modified Files
--------------
doc/src/sgml/func.sgml | 9 +++++++
src/backend/commands/waitlsn.c | 42 +++++++++++++++++++++++-------
src/test/recovery/t/043_wal_replay_wait.pl | 15 +++++++++--
3 files changed, 55 insertions(+), 11 deletions(-)
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: akorotkov@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Adjust pg_wal_replay_wait() procedure behavior on promoted stand
In-Reply-To: <E1scr3w-003bVZ-AQ@gemulon.postgresql.org>
* 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