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

Commit9f3e4c8

Browse files
committed
Avoid consuming an XID during vac_truncate_clog().
vac_truncate_clog() uses its own transaction ID as the comparison point ina sanity check that no database's datfrozenxid has already wrapped around"into the future". That was probably fine when written, but in a lazyvacuum we won't have assigned an XID, so calling GetCurrentTransactionId()causes an XID to be assigned when otherwise one would not be. Most of thetime that's not a big problem ... but if we are hard up against thewraparound limit, consuming XIDs during antiwraparound vacuums is a verybad thing.Instead, use ReadNewTransactionId(), which not only avoids this problembut is in itself a better comparison point to test whether wraparoundhas already occurred.Report and patch by Alexander Korotkov. Back-patch to all versions.Report: <CAPpHfdspOkmiQsxh-UZw2chM6dRMwXAJGEmmbmqYR=yvM7-s6A@mail.gmail.com>
1 parentde52198 commit9f3e4c8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎src/backend/commands/vacuum.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ vac_truncate_clog(TransactionId frozenXID,
10021002
TransactionIdlastSaneFrozenXid,
10031003
MultiXactIdlastSaneMinMulti)
10041004
{
1005-
TransactionIdmyXID=GetCurrentTransactionId();
1005+
TransactionIdnextXID=ReadNewTransactionId();
10061006
Relationrelation;
10071007
HeapScanDescscan;
10081008
HeapTupletuple;
@@ -1051,7 +1051,7 @@ vac_truncate_clog(TransactionId frozenXID,
10511051
MultiXactIdPrecedes(lastSaneMinMulti,dbform->datminmxid))
10521052
bogus= true;
10531053

1054-
if (TransactionIdPrecedes(myXID,dbform->datfrozenxid))
1054+
if (TransactionIdPrecedes(nextXID,dbform->datfrozenxid))
10551055
frozenAlreadyWrapped= true;
10561056
elseif (TransactionIdPrecedes(dbform->datfrozenxid,frozenXID))
10571057
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp