Skip to content

Commit 7cfdb4d

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 0350b87 commit 7cfdb4d

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
@@ -920,15 +920,15 @@ SnapshotResetXmin(void)
920920

921921
if (pairingheap_is_empty(&RegisteredSnapshots))
922922
{
923-
MyProc->xmin = InvalidTransactionId;
923+
MyProc->xmin = TransactionXmin = InvalidTransactionId;
924924
return;
925925
}
926926

927927
minSnapshot = pairingheap_container(SnapshotData, ph_node,
928928
pairingheap_first(&RegisteredSnapshots));
929929

930930
if (TransactionIdPrecedes(MyProc->xmin, minSnapshot->xmin))
931-
MyProc->xmin = minSnapshot->xmin;
931+
MyProc->xmin = TransactionXmin = minSnapshot->xmin;
932932
}
933933

934934
/*

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