diff options
author | Magnus Hagander <magnus@hagander.net> | 2012-07-04 15:10:46 +0200 |
---|---|---|
committer | Magnus Hagander <magnus@hagander.net> | 2012-07-04 15:24:17 +0200 |
commit | b8aca12d77612007ebde22db14e3971ef664d553 (patch) | |
tree | b02529f17136f108184d261435988f273d2c3d41 /src/backend/replication/walsender.c | |
parent | 119027ec8b8d02c8d70e4916df1b41cde78f674d (diff) |
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
Diffstat (limited to 'src/backend/replication/walsender.c')
-rw-r--r-- | src/backend/replication/walsender.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index 32cc52dbfd7..1648eedf90d 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -1443,12 +1443,19 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS) if (walsnd->pid != 0) { - sync_priority[i] = walsnd->sync_standby_priority; + /* + * Treat a standby such as a pg_basebackup background process + * which always returns an invalid flush location, as an + * asynchronous standby. + */ + sync_priority[i] = XLogRecPtrIsInvalid(walsnd->flush) ? + 0 : walsnd->sync_standby_priority; if (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; sync_standby = i; |