From c85c941470efc44494fd7a5f426ee85fc65c268c Mon Sep 17 00:00:00 2001 From: Simon Riggs Date: Sun, 31 Jan 2010 19:01:11 +0000 Subject: Detect early deadlock in Hot Standby when Startup is already waiting. First stage of required deadlock detection to allow re-enabling max_standby_delay setting of -1, which is now essential in the absence of improved relation- specific conflict resoluton. Requested by Greg Stark et al. --- src/backend/storage/lmgr/lock.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/backend/storage/lmgr/lock.c') diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c index cbc2070c37..c59355cfc2 100644 --- a/src/backend/storage/lmgr/lock.c +++ b/src/backend/storage/lmgr/lock.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.193 2010/01/29 19:45:12 sriggs Exp $ + * $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.194 2010/01/31 19:01:11 sriggs Exp $ * * NOTES * A lock table is a shared memory hash table. When @@ -814,6 +814,13 @@ LockAcquireExtended(const LOCKTAG *locktag, return LOCKACQUIRE_NOT_AVAIL; } + /* + * In Hot Standby perform early deadlock detection in normal backends. + * If deadlock found we release partition lock but do not return. + */ + if (RecoveryInProgress() && !InRecovery) + CheckRecoveryConflictDeadlock(partitionLock); + /* * Set bitmask of locks this process already holds on this object. */ -- cgit v1.2.1