diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2011-03-31 18:43:23 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2011-03-31 18:43:23 +0300 |
commit | 60b142b9a6f413a92665766a1f265b361f68c20b (patch) | |
tree | 5b2f0d7b30165f323354d3c46e3f03da3cb78396 | |
parent | c8ae318cbeceadac172aa6b9cfa43734b0836e5e (diff) | |
download | postgresql-60b142b9a6f413a92665766a1f265b361f68c20b.tar.gz postgresql-60b142b9a6f413a92665766a1f265b361f68c20b.zip |
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
-rw-r--r-- | src/backend/storage/lmgr/predicate.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c index 870cf4277cf..401acdb4715 100644 --- a/src/backend/storage/lmgr/predicate.c +++ b/src/backend/storage/lmgr/predicate.c @@ -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; |