Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 60b142b

Browse files
committed
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
1 parent c8ae318 commit 60b142b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/backend/storage/lmgr/predicate.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,9 +1755,8 @@ CoarserLockCovers(const PREDICATELOCKTARGETTAG *newtargettag)
17551755
}
17561756

17571757
/*
1758-
* Check whether both the list of related predicate locks and the pointer to
1759-
* a prior version of the row (if this is a tuple lock target) are empty for
1760-
* a predicate lock target, and remove the target if they are.
1758+
* Check whether the list of related predicate locks is empty for a
1759+
* predicate lock target, and remove the target if it is.
17611760
*/
17621761
static void
17631762
RemoveTargetIfNoLongerUsed(PREDICATELOCKTARGET *target, uint32 targettaghash)
@@ -3120,11 +3119,11 @@ ClearOldPredicateLocks(void)
31203119
/*
31213120
* Loop through predicate locks on dummy transaction for summarized data.
31223121
*/
3122+
LWLockAcquire(SerializablePredicateLockListLock, LW_SHARED);
31233123
predlock = (PREDICATELOCK *)
31243124
SHMQueueNext(&OldCommittedSxact->predicateLocks,
31253125
&OldCommittedSxact->predicateLocks,
31263126
offsetof(PREDICATELOCK, xactLink));
3127-
LWLockAcquire(SerializablePredicateLockListLock, LW_SHARED);
31283127
while (predlock)
31293128
{
31303129
PREDICATELOCK *nextpredlock;

0 commit comments

Comments
 (0)