mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +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:
@@ -376,10 +376,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;
|
||||
|
||||
/*
|
||||
@@ -399,7 +401,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;
|
||||
|
||||
Reference in New Issue
Block a user