Adjust pg_wal_replay_wait() procedure behavior on promoted standby
Alexander Korotkov <akorotkov@postgresql.org>
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
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/func.sgml | modified | +9 −0 |
| src/backend/commands/waitlsn.c | modified | +33 −9 |
| src/test/recovery/t/043_wal_replay_wait.pl | modified | +13 −2 |
Documentation touched
Discussion
- Re: [HACKERS] make async slave to wait for lsn to be replayed 113 messages · 2023-02-28 → 2024-09-17