agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Re-read standby LSN after recovery ends
2+ messages / 1 participants
[nested] [flat]

* pgsql: Re-read standby LSN after recovery ends
@ 2026-09-12 20:30 Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alexander Korotkov @ 2026-09-12 20:30 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Re-read standby LSN after recovery ends
@ 2026-09-12 20:30 Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alexander Korotkov @ 2026-09-12 20:30 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6bc236c8a5b198e7ffde80377777167f1d4b78bb

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-09-12 20:30 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-12 20:30 pgsql: Re-read standby LSN after recovery ends Alexander Korotkov <akorotkov@postgresql.org>
2026-09-12 20:30 pgsql: Re-read standby LSN after recovery ends Alexander Korotkov <akorotkov@postgresql.org>

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