aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/lmgr/proc.c
diff options
context:
space:
mode:
authorSimon Riggs <simon@2ndQuadrant.com>2010-02-13 01:32:20 +0000
committerSimon Riggs <simon@2ndQuadrant.com>2010-02-13 01:32:20 +0000
commitb95a720a487b5027af1b9e4a12542800598ff5de (patch)
treed49548ca497e8169d9cbae7f7127f4f73330f0a5 /src/backend/storage/lmgr/proc.c
parentfafa374f2d1e04ab265d56cdadb634124364646f (diff)
downloadpostgresql-b95a720a487b5027af1b9e4a12542800598ff5de.tar.gz
postgresql-b95a720a487b5027af1b9e4a12542800598ff5de.zip
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.
Diffstat (limited to 'src/backend/storage/lmgr/proc.c')
-rw-r--r--src/backend/storage/lmgr/proc.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index a96a558da32..1e103743b2e 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 */