aboutsummaryrefslogtreecommitdiff
path: root/src/backend/postmaster/postmaster.c
diff options
context:
space:
mode:
authorSimon Riggs <simon@2ndQuadrant.com>2011-09-07 09:09:47 +0100
committerSimon Riggs <simon@2ndQuadrant.com>2011-09-07 09:09:47 +0100
commitdde70cc313683e47e71997759c6029b4220f71c0 (patch)
treeffede6886e20a2b105afe793dc823c16a9af96f3 /src/backend/postmaster/postmaster.c
parent39039e6d7a48d37aedcfca7973cea3288ce356d4 (diff)
downloadpostgresql-dde70cc313683e47e71997759c6029b4220f71c0.tar.gz
postgresql-dde70cc313683e47e71997759c6029b4220f71c0.zip
Emit cascaded standby message on shutdown only when appropriate.
Adds additional test for active walsenders and closes a race condition for when we failover when a new walsender was connecting. Reported and fixed bu Fujii Masao. Review by Heikki Linnakangas
Diffstat (limited to 'src/backend/postmaster/postmaster.c')
-rw-r--r--src/backend/postmaster/postmaster.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 6e231a538f4..df4a2aa8853 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -2328,10 +2328,11 @@ reaper(SIGNAL_ARGS)
* XXX should avoid the need for disconnection. When we do,
* am_cascading_walsender should be replaced with RecoveryInProgress()
*/
- if (max_wal_senders > 0)
+ if (max_wal_senders > 0 && CountChildren(BACKEND_TYPE_WALSND) > 0)
{
ereport(LOG,
- (errmsg("terminating all walsender processes to force cascaded standby(s) to update timeline and reconnect")));
+ (errmsg("terminating all walsender processes to force cascaded "
+ "standby(s) to update timeline and reconnect")));
SignalSomeChildren(SIGUSR2, BACKEND_TYPE_WALSND);
}