Fix a tiny race condition in predicate locking. Need to hold the lock while

examining the head of predicate locks list. Also, fix the comment of
RemoveTargetIfNoLongerUsed, it was neglected when we changed the way update
chains are handled.

Kevin Grittner
This commit is contained in:
Heikki Linnakangas 2011-03-31 18:43:23 +03:00
parent c8ae318cbe
commit 60b142b9a6
1 changed files with 3 additions and 4 deletions

View File

@ -1755,9 +1755,8 @@ CoarserLockCovers(const PREDICATELOCKTARGETTAG *newtargettag)
}
/*
* Check whether both the list of related predicate locks and the pointer to
* a prior version of the row (if this is a tuple lock target) are empty for
* a predicate lock target, and remove the target if they are.
* Check whether the list of related predicate locks is empty for a
* predicate lock target, and remove the target if it is.
*/
static void
RemoveTargetIfNoLongerUsed(PREDICATELOCKTARGET *target, uint32 targettaghash)
@ -3120,11 +3119,11 @@ ClearOldPredicateLocks(void)
/*
* Loop through predicate locks on dummy transaction for summarized data.
*/
LWLockAcquire(SerializablePredicateLockListLock, LW_SHARED);
predlock = (PREDICATELOCK *)
SHMQueueNext(&OldCommittedSxact->predicateLocks,
&OldCommittedSxact->predicateLocks,
offsetof(PREDICATELOCK, xactLink));
LWLockAcquire(SerializablePredicateLockListLock, LW_SHARED);
while (predlock)
{
PREDICATELOCK *nextpredlock;