mirror of
https://github.com/postgres/postgres.git
synced 2025-05-18 17:41:14 +03:00
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.
This commit is contained in:
parent
21aa47d017
commit
e118822e72
@ -1542,6 +1542,7 @@ AbortStrongLockAcquire(void)
|
|||||||
fasthashcode = FastPathStrongLockHashPartition(locallock->hashcode);
|
fasthashcode = FastPathStrongLockHashPartition(locallock->hashcode);
|
||||||
Assert(locallock->holdsStrongLockCount == TRUE);
|
Assert(locallock->holdsStrongLockCount == TRUE);
|
||||||
SpinLockAcquire(&FastPathStrongRelationLocks->mutex);
|
SpinLockAcquire(&FastPathStrongRelationLocks->mutex);
|
||||||
|
Assert(FastPathStrongRelationLocks->count[fasthashcode] > 0);
|
||||||
FastPathStrongRelationLocks->count[fasthashcode]--;
|
FastPathStrongRelationLocks->count[fasthashcode]--;
|
||||||
locallock->holdsStrongLockCount = FALSE;
|
locallock->holdsStrongLockCount = FALSE;
|
||||||
StrongLockInProgress = NULL;
|
StrongLockInProgress = NULL;
|
||||||
@ -2952,6 +2953,7 @@ LockRefindAndRelease(LockMethod lockMethodTable, PGPROC *proc,
|
|||||||
uint32 fasthashcode = FastPathStrongLockHashPartition(hashcode);
|
uint32 fasthashcode = FastPathStrongLockHashPartition(hashcode);
|
||||||
|
|
||||||
SpinLockAcquire(&FastPathStrongRelationLocks->mutex);
|
SpinLockAcquire(&FastPathStrongRelationLocks->mutex);
|
||||||
|
Assert(FastPathStrongRelationLocks->count[fasthashcode] > 0);
|
||||||
FastPathStrongRelationLocks->count[fasthashcode]--;
|
FastPathStrongRelationLocks->count[fasthashcode]--;
|
||||||
SpinLockRelease(&FastPathStrongRelationLocks->mutex);
|
SpinLockRelease(&FastPathStrongRelationLocks->mutex);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user