1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-15 19:21:59 +03:00

Re-enable max_standby_delay = -1 using deadlock detection on startup

process. If startup waits on a buffer pin we send a request to all
backends to cancel themselves if they are holding the buffer pin
required and they are also waiting on a lock. If not, startup waits
until max_standby_delay before cancelling any backend waiting for
the requested buffer pin.
This commit is contained in:
Simon Riggs
2010-02-13 01:32:20 +00:00
parent fafa374f2d
commit b95a720a48
8 changed files with 86 additions and 26 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.215 2010/02/08 04:33:54 tgl Exp $
* $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.216 2010/02/13 01:32:19 sriggs Exp $
*
*-------------------------------------------------------------------------
*/
@ -45,6 +45,7 @@
#include "storage/pmsignal.h"
#include "storage/proc.h"
#include "storage/procarray.h"
#include "storage/procsignal.h"
#include "storage/spin.h"
@ -556,6 +557,15 @@ HaveNFreeProcs(int n)
return (n <= 0);
}
bool
IsWaitingForLock(void)
{
if (lockAwaited == NULL)
return false;
return true;
}
/*
* Cancel any pending wait for lock, when aborting a transaction.
*
@ -1670,7 +1680,7 @@ CheckStandbyTimeout(void)
now = GetCurrentTimestamp();
if (now >= statement_fin_time)
SendRecoveryConflictWithBufferPin();
SendRecoveryConflictWithBufferPin(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN);
else
{
/* Not time yet, so (re)schedule the interrupt */