From 580b94168e2218a2a32d6792139d51c63104b2c2 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Mon, 11 Jun 2012 15:07:55 +0200 Subject: [PATCH] Prevent non-streaming replication connections from being selected sync slave This prevents a pg_basebackup backup session that just does a base backup (no xlog involved at all) from becoming the synchronous slave and thus blocking all access while it runs. Also fixes the problem when a higher priority slave shows up it would become the sync standby before it has reached the STREAMING state, by making sure we can only switch to a walsender that's actually STREAMING. Fujii Masao --- src/backend/replication/syncrep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c index 6463420cd85..d475e0383d4 100644 --- a/src/backend/replication/syncrep.c +++ b/src/backend/replication/syncrep.c @@ -399,6 +399,7 @@ SyncRepReleaseWaiters(void) volatile WalSnd *walsnd = &walsndctl->walsnds[i]; if (walsnd->pid != 0 && + walsnd->state == WALSNDSTATE_STREAMING && walsnd->sync_standby_priority > 0 && (priority == 0 || priority > walsnd->sync_standby_priority)) -- 2.47.2