Skip to content

Commit 578a7fe

Browse files
committed
Update TransactionXmin when MyProc->xmin is updated
GetSnapshotData() set TransactionXmin = MyProc->xmin, but when SnapshotResetXmin() advanced MyProc->xmin, it did not advance TransactionXmin correspondingly. That meant that TransactionXmin could be older than MyProc->xmin, and XIDs between than TransactionXmin and the real MyProc->xmin could be vacuumed away. One known consequence is in pg_subtrans lookups: we might try to look up the status of an XID that was already truncated away. Back-patch to all supported versions. Reviewed-by: Andres Freund Discussion: https://www.postgresql.org/message-id/d27a046d-a1e4-47d1-a95c-fbabe41debb4@iki.fi
1 parent db448ce commit 578a7fe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/utils/time/snapmgr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,15 +875,15 @@ SnapshotResetXmin(void)
875875

876876
if (pairingheap_is_empty(&RegisteredSnapshots))
877877
{
878-
MyProc->xmin = InvalidTransactionId;
878+
MyProc->xmin = TransactionXmin = InvalidTransactionId;
879879
return;
880880
}
881881

882882
minSnapshot = pairingheap_container(SnapshotData, ph_node,
883883
pairingheap_first(&RegisteredSnapshots));
884884

885885
if (TransactionIdPrecedes(MyProc->xmin, minSnapshot->xmin))
886-
MyProc->xmin = minSnapshot->xmin;
886+
MyProc->xmin = TransactionXmin = minSnapshot->xmin;
887887
}
888888

889889
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy