agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Alexander Korotkov <akorotkov@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Re-read standby LSN after recovery ends
Date: Sat, 12 Sep 2026 20:30:45 +0000
Message-ID: <E1x5UN3-000000003qs-06SB@gemulon.postgresql.org> (raw)

Re-read standby LSN after recovery ends

WaitForLSN() samples the current position before checking whether
recovery is still in progress. If recovery reaches the target and ends
between those operations, the promotion path can compare against the
stale sample and incorrectly return NOT_IN_RECOVERY.

Read the position again after observing that recovery has ended, before
deciding whether promotion reached the target.

Author: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/CABPTF7U0gW5%2B-4oL7-qdML-yerZxUb7ku4QXp7JxCYo0qyJ_Tw%40mail.gmail.com
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8c7a74c3239ce29940582643533a190721b395c0

Modified Files
--------------
src/backend/access/transam/xlogwait.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1x5UN3-000000003qs-06SB@gemulon.postgresql.org>
Permalink:  ../E1x5UN3-000000003qs-06SB@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1x5UN3-000000003qs-06SB@gemulon.postgresql.org

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: akorotkov@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Re-read standby LSN after recovery ends
  In-Reply-To: <E1x5UN3-000000003qs-06SB@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox