Skip to content

Commit 34ef02b

Browse files
committed
Before exiting walreceiver, fsync() all the WAL received.
Otherwise WAL recovery will replay the un-flushed WAL after walreceiver has exited, which can lead to a non-recoverable standby if the system crashes hard at that point.
1 parent e0c2746 commit 34ef02b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/backend/replication/walreceiver.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,9 @@ WalRcvDie(int code, Datum arg)
324324
/* use volatile pointer to prevent code rearrangement */
325325
volatile WalRcvData *walrcv = WalRcv;
326326

327+
/* Ensure that all WAL records received are flushed to disk */
328+
XLogWalRcvFlush();
329+
327330
SpinLockAcquire(&walrcv->mutex);
328331
Assert(walrcv->walRcvState == WALRCV_RUNNING ||
329332
walrcv->walRcvState == WALRCV_STOPPING);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy