Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit326b922

Browse files
committed
Fix corner case in cleanup of transactions using SSI.
When the only remaining active transactions are READ ONLY, we do a "partialcleanup" of committed transactions because certain types of conflictsaren't possible anymore. For committed r/w transactions, we release theSIREAD locks but keep the SERIALIZABLEXACT. However, for committed r/otransactions, we can go further and release the SERIALIZABLEXACT too. Theproblem was with the latter case: we were returning the SERIALIZABLEXACT tothe free list without removing it from the finished list.The only real change in the patch is the SHMQueueDelete line, but I alsoreworked some of the surrounding code to make it obvious that r/o and r/wtransactions are handled differently -- the existing code felt a bit tooclever.Dan Ports
1 parent2106c55 commit326b922

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

‎src/backend/storage/lmgr/predicate.c

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3528,10 +3528,29 @@ ClearOldPredicateLocks(void)
35283528
elseif (finishedSxact->commitSeqNo>PredXact->HavePartialClearedThrough
35293529
&&finishedSxact->commitSeqNo <=PredXact->CanPartialClearThrough)
35303530
{
3531+
/*
3532+
* Any active transactions that took their snapshot before this
3533+
* transaction committed are read-only, so we can clear part of
3534+
* its state.
3535+
*/
35313536
LWLockRelease(SerializableXactHashLock);
3532-
ReleaseOneSerializableXact(finishedSxact,
3533-
!SxactIsReadOnly(finishedSxact),
3534-
false);
3537+
3538+
if (SxactIsReadOnly(finishedSxact))
3539+
{
3540+
/* A read-only transaction can be removed entirely */
3541+
SHMQueueDelete(&(finishedSxact->finishedLink));
3542+
ReleaseOneSerializableXact(finishedSxact, false, false);
3543+
}
3544+
else
3545+
{
3546+
/*
3547+
* A read-write transaction can only be partially
3548+
* cleared. We need to keep the SERIALIZABLEXACT but
3549+
* can release the SIREAD locks and conflicts in.
3550+
*/
3551+
ReleaseOneSerializableXact(finishedSxact, true, false);
3552+
}
3553+
35353554
PredXact->HavePartialClearedThrough=finishedSxact->commitSeqNo;
35363555
LWLockAcquire(SerializableXactHashLock,LW_SHARED);
35373556
}
@@ -3637,6 +3656,7 @@ ReleaseOneSerializableXact(SERIALIZABLEXACT *sxact, bool partial,
36373656

36383657
Assert(sxact!=NULL);
36393658
Assert(SxactIsRolledBack(sxact)||SxactIsCommitted(sxact));
3659+
Assert(partial|| !SxactIsOnFinishedList(sxact));
36403660
Assert(LWLockHeldByMe(SerializableFinishedListLock));
36413661

36423662
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp