]> granicus.if.org Git - postgresql/commitdiff
Prevent non-streaming replication connections from being selected sync slave
authorMagnus Hagander <magnus@hagander.net>
Mon, 11 Jun 2012 13:07:55 +0000 (15:07 +0200)
committerMagnus Hagander <magnus@hagander.net>
Mon, 11 Jun 2012 13:17:52 +0000 (15:17 +0200)
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

index 6463420cd85f420897d1292f9d98d28f28f67764..d475e0383d4060274de5453d3eea1938660d3f0a 100644 (file)
@@ -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))