From b8aca12d77612007ebde22db14e3971ef664d553 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Wed, 4 Jul 2012 15:10:46 +0200 Subject: Always treat a standby returning an an invalid flush location as async This ensures that a standby such as pg_receivexlog will not be selected as sync standby - which would cause the master to block waiting for a location that could never happen. Fujii Masao --- src/backend/replication/syncrep.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/backend/replication/syncrep.c') diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c index d475e0383d4..10af4e85c13 100644 --- a/src/backend/replication/syncrep.c +++ b/src/backend/replication/syncrep.c @@ -379,10 +379,12 @@ SyncRepReleaseWaiters(void) /* * If this WALSender is serving a standby that is not on the list of * potential standbys then we have nothing to do. If we are still starting - * up or still running base backup, then leave quickly also. + * up, still running base backup or the current flush position is still + * invalid, then leave quickly also. */ if (MyWalSnd->sync_standby_priority == 0 || - MyWalSnd->state < WALSNDSTATE_STREAMING) + MyWalSnd->state < WALSNDSTATE_STREAMING || + XLogRecPtrIsInvalid(MyWalSnd->flush)) return; /* @@ -402,7 +404,8 @@ SyncRepReleaseWaiters(void) walsnd->state == WALSNDSTATE_STREAMING && walsnd->sync_standby_priority > 0 && (priority == 0 || - priority > walsnd->sync_standby_priority)) + priority > walsnd->sync_standby_priority) && + !XLogRecPtrIsInvalid(walsnd->flush)) { priority = walsnd->sync_standby_priority; syncWalSnd = walsnd; -- cgit v1.2.3