git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a08363d)
Before exiting walreceiver, fsync() all the WAL received.
2011年1月17日 10:22:24 +0000 (12:22 +0200)
2011年1月17日 10:29:15 +0000 (12:29 +0200)
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.


diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c
index 06646ead94a468524bede8ba79590aafcdf03580..df4610732b1179304c9e5615771b47a2796ab010 100644 (file)
--- a/src/backend/replication/walreceiver.c
+++ b/src/backend/replication/walreceiver.c
@@ -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);
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /