aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2014-04-07 10:59:42 -0400
committerRobert Haas <rhaas@postgresql.org>2014-04-07 11:05:18 -0400
commite118822e72486aec32bbbecd3cf7543dbb756c58 (patch)
tree07f46ab35e05dd434e1377795be1f43da427d634 /src
parent21aa47d0175c583db5fc1361d9482efd37a393fd (diff)
downloadpostgresql-e118822e72486aec32bbbecd3cf7543dbb756c58.tar.gz
postgresql-e118822e72486aec32bbbecd3cf7543dbb756c58.zip
Assert that strong-lock count is >0 everywhere it's decremented.
The one existing assertion of this type has tripped a few times in the buildfarm lately, but it's not clear whether the problem is really originating there or whether it's leftovers from a trip through one of the other two paths that lack a matching assertion. So add one. Since the same bug(s) most likely exist(s) in the back-branches also, back-patch to 9.2, where the fast-path lock mechanism was added.
Diffstat (limited to 'src')
-rw-r--r--src/backend/storage/lmgr/lock.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index 0f218280090..676b3a49382 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -1542,6 +1542,7 @@ AbortStrongLockAcquire(void)
fasthashcode = FastPathStrongLockHashPartition(locallock->hashcode);
Assert(locallock->holdsStrongLockCount == TRUE);
SpinLockAcquire(&FastPathStrongRelationLocks->mutex);
+ Assert(FastPathStrongRelationLocks->count[fasthashcode] > 0);
FastPathStrongRelationLocks->count[fasthashcode]--;
locallock->holdsStrongLockCount = FALSE;
StrongLockInProgress = NULL;
@@ -2952,6 +2953,7 @@ LockRefindAndRelease(LockMethod lockMethodTable, PGPROC *proc,
uint32 fasthashcode = FastPathStrongLockHashPartition(hashcode);
SpinLockAcquire(&FastPathStrongRelationLocks->mutex);
+ Assert(FastPathStrongRelationLocks->count[fasthashcode] > 0);
FastPathStrongRelationLocks->count[fasthashcode]--;
SpinLockRelease(&FastPathStrongRelationLocks->mutex);
}