OSDN Git Service

Before exiting walreceiver, fsync() all the WAL received.
[pg-rex/syncrep.git] / src / backend / replication / walreceiver.c
index 06646ea..df46107 100644 (file)
@@ -323,6 +323,9 @@ WalRcvDie(int code, Datum arg)
        /* use volatile pointer to prevent code rearrangement */
        volatile WalRcvData *walrcv = WalRcv;
 
+       /* Ensure that all WAL records received are flushed to disk */
+       XLogWalRcvFlush();
+
        SpinLockAcquire(&walrcv->mutex);
        Assert(walrcv->walRcvState == WALRCV_RUNNING ||
                   walrcv->walRcvState == WALRCV_STOPPING);