mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
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
This commit is contained in:
@@ -1510,12 +1510,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;
|
||||
|
Reference in New Issue
Block a user