aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/replication/walsender.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index 6683b6fb475..395f8999d3b 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -2486,13 +2486,14 @@ WalSndDone(WalSndSendDataCallback send_data)
send_data();
/*
- * Check a write location to see whether all the WAL have successfully
- * been replicated if this walsender is connecting to a standby such as
- * pg_receivexlog which always returns an invalid flush location.
- * Otherwise, check a flush location.
+ * To figure out whether all WAL has successfully been replicated, check
+ * flush location if valid, write otherwise. Tools like pg_receivexlog
+ * will usually (unless in synchronous mode) return an invalid flush
+ * location.
*/
replicatedPtr = XLogRecPtrIsInvalid(MyWalSnd->flush) ?
MyWalSnd->write : MyWalSnd->flush;
+
if (WalSndCaughtUp && sentPtr == replicatedPtr &&
!pq_is_send_pending())
{
@@ -2503,7 +2504,10 @@ WalSndDone(WalSndSendDataCallback send_data)
proc_exit(0);
}
if (!waiting_for_ping_response)
+ {
WalSndKeepalive(true);
+ waiting_for_ping_response = true;
+ }
}
/*