mirror of
https://github.com/postgres/postgres.git
synced 2025-06-04 12:42:24 +03:00
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
This commit is contained in:
parent
db448ce5ad
commit
578a7fe7b6
@ -875,7 +875,7 @@ SnapshotResetXmin(void)
|
|||||||
|
|
||||||
if (pairingheap_is_empty(&RegisteredSnapshots))
|
if (pairingheap_is_empty(&RegisteredSnapshots))
|
||||||
{
|
{
|
||||||
MyProc->xmin = InvalidTransactionId;
|
MyProc->xmin = TransactionXmin = InvalidTransactionId;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -883,7 +883,7 @@ SnapshotResetXmin(void)
|
|||||||
pairingheap_first(&RegisteredSnapshots));
|
pairingheap_first(&RegisteredSnapshots));
|
||||||
|
|
||||||
if (TransactionIdPrecedes(MyProc->xmin, minSnapshot->xmin))
|
if (TransactionIdPrecedes(MyProc->xmin, minSnapshot->xmin))
|
||||||
MyProc->xmin = minSnapshot->xmin;
|
MyProc->xmin = TransactionXmin = minSnapshot->xmin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user