diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c index 10708b9286d..2288f51ea9c 100644 --- a/src/backend/storage/lmgr/predicate.c +++ b/src/backend/storage/lmgr/predicate.c @@ -923,12 +923,17 @@ OldSerXidAdd(TransactionId xid, SerCommitSeqNo minConflictCommitSeqNo) LWLockAcquire(OldSerXidLock, LW_EXCLUSIVE); /* - * If no serializable transactions are active, there shouldn't be anything - * to push out to the SLRU. Hitting this assert would mean there's - * something wrong with the earlier cleanup logic. + * If 'xid' is older than the global xmin (== tailXid), there's no need to + * store it, after all. This can happen if the oldest transaction holding + * back the global xmin just finished, making 'xid' uninteresting, but + * ClearOldPredicateLocks() has not yet run. */ tailXid = oldSerXidControl->tailXid; - Assert(TransactionIdIsValid(tailXid)); + if (!TransactionIdIsValid(tailXid) || TransactionIdPrecedes(xid, tailXid)) + { + LWLockRelease(OldSerXidLock); + return; + } /* * If the SLRU is currently unused, zero out the whole active region from