From b95a720a487b5027af1b9e4a12542800598ff5de Mon Sep 17 00:00:00 2001 From: Simon Riggs Date: Sat, 13 Feb 2010 01:32:20 +0000 Subject: 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. --- src/backend/storage/lmgr/proc.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/backend/storage/lmgr/proc.c') diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index a96a558da3..1e103743b2 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -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 */ -- cgit v1.2.1