| From: | Alexander Korotkov <akorotkov(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Re-read standby LSN after recovery ends |
| Date: | 2026-09-12 20:30:45 |
| Message-ID: | E1x5UN3-000000003qs-06SB@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(at)gmail(dot)com>
Discussion: https://postgr.es/m/CABPTF7U0gW5%2B-4oL7-qdML-yerZxUb7ku4QXp7JxCYo0qyJ_Tw%40mail.gmail.com
Reviewed-by: Alexander Korotkov <aekorotkov(at)gmail(dot)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(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alexander Korotkov | 2026-09-12 20:30:50 | pgsql: Prevent WAIT FOR LSN from deadlocking recovery on held locks |
| Previous Message | Alexander Korotkov | 2026-09-12 20:30:44 | pgsql: Prevent WAIT FOR LSN from deadlocking recovery on held locks |