pgsql: Re-read standby LSN after recovery ends

Started by Alexander Korotkov3 months ago1 messagescommitters
Jump to latest
#1Alexander Korotkov
akorotkov@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: /messages/by-id/CABPTF7U0gW5+-4oL7-qdML-yerZxUb7ku4QXp7JxCYo0qyJ_Tw@mail.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(-)