aboutsummaryrefslogtreecommitdiff
path: root/src/backend/replication
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/replication')
-rw-r--r--src/backend/replication/syncrep.c4
-rw-r--r--src/backend/replication/walreceiver.c2
-rw-r--r--src/backend/replication/walsender.c13
3 files changed, 11 insertions, 8 deletions
diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c
index 2b52d1616be..b73d225a8ef 100644
--- a/src/backend/replication/syncrep.c
+++ b/src/backend/replication/syncrep.c
@@ -171,7 +171,7 @@ SyncRepWaitForLSN(XLogRecPtr XactCommitLSN)
* postmaster death regularly while waiting. Note that timeout here
* does not necessarily release from loop.
*/
- WaitLatch(&MyProc->waitLatch, 60000000L);
+ WaitLatch(&MyProc->waitLatch, WL_LATCH_SET | WL_TIMEOUT, 60000000L);
/* Must reset the latch before testing state. */
ResetLatch(&MyProc->waitLatch);
@@ -239,7 +239,7 @@ SyncRepWaitForLSN(XLogRecPtr XactCommitLSN)
* acknowledgement, because all the wal sender processes will exit. So
* just bail out.
*/
- if (!PostmasterIsAlive(true))
+ if (!PostmasterIsAlive())
{
ProcDiePending = true;
whereToSendOutput = DestNone;
diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c
index 471c844ab2a..ea6f6cdcdaf 100644
--- a/src/backend/replication/walreceiver.c
+++ b/src/backend/replication/walreceiver.c
@@ -287,7 +287,7 @@ WalReceiverMain(void)
* Emergency bailout if postmaster has died. This is to avoid the
* necessity for manual cleanup of all postmaster children.
*/
- if (!PostmasterIsAlive(true))
+ if (!PostmasterIsAlive())
exit(1);
/*
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index 63952e73f13..bc5b3300d23 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -212,7 +212,7 @@ WalSndHandshake(void)
* Emergency bailout if postmaster has died. This is to avoid the
* necessity for manual cleanup of all postmaster children.
*/
- if (!PostmasterIsAlive(true))
+ if (!PostmasterIsAlive())
exit(1);
/*
@@ -713,7 +713,7 @@ WalSndLoop(void)
* Emergency bailout if postmaster has died. This is to avoid the
* necessity for manual cleanup of all postmaster children.
*/
- if (!PostmasterIsAlive(true))
+ if (!PostmasterIsAlive())
exit(1);
/* Process any requests or signals received recently */
@@ -779,6 +779,7 @@ WalSndLoop(void)
{
TimestampTz finish_time = 0;
long sleeptime;
+ int wakeEvents;
/* Reschedule replication timeout */
if (replication_timeout > 0)
@@ -805,9 +806,11 @@ WalSndLoop(void)
}
/* Sleep */
- WaitLatchOrSocket(&MyWalSnd->latch, MyProcPort->sock,
- true, pq_is_send_pending(),
- sleeptime * 1000L);
+ wakeEvents = WL_LATCH_SET | WL_SOCKET_READABLE | WL_TIMEOUT;
+ if (pq_is_send_pending())
+ wakeEvents |= WL_SOCKET_WRITEABLE;
+ WaitLatchOrSocket(&MyWalSnd->latch, wakeEvents,
+ MyProcPort->sock, sleeptime * 1000L);
/* Check for replication timeout */
if (replication_timeout > 0 &&