diff options
author | Robert Haas <rhaas@postgresql.org> | 2014-04-07 10:59:42 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2014-04-07 11:15:13 -0400 |
commit | 74cf8028411700474b5464d62dafdc32d48583aa (patch) | |
tree | eaf276709a6cfed6cb0339f2459591017e66cbf2 | |
parent | 53463e2479b7a8a8c470c4a3b57f218a407b98da (diff) | |
download | postgresql-74cf8028411700474b5464d62dafdc32d48583aa.tar.gz postgresql-74cf8028411700474b5464d62dafdc32d48583aa.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.
-rw-r--r-- | src/backend/storage/lmgr/lock.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c index 3566208904c..15fbe86107d 100644 --- a/src/backend/storage/lmgr/lock.c +++ b/src/backend/storage/lmgr/lock.c @@ -1516,6 +1516,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; @@ -2882,6 +2883,7 @@ LockRefindAndRelease(LockMethod lockMethodTable, PGPROC *proc, uint32 fasthashcode = FastPathStrongLockHashPartition(hashcode); SpinLockAcquire(&FastPathStrongRelationLocks->mutex); + Assert(FastPathStrongRelationLocks->count[fasthashcode] > 0); FastPathStrongRelationLocks->count[fasthashcode]--; SpinLockRelease(&FastPathStrongRelationLocks->mutex); } |