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

Commit996d273

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 parent0c7cd45 commit996d273

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
@@ -1051,7 +1051,7 @@ vac_truncate_clog(TransactionId frozenXID,
10511051
TransactionIdlastSaneFrozenXid,
10521052
MultiXactIdlastSaneMinMulti)
10531053
{
1054-
TransactionIdmyXID=GetCurrentTransactionId();
1054+
TransactionIdnextXID=ReadNewTransactionId();
10551055
Relationrelation;
10561056
HeapScanDescscan;
10571057
HeapTupletuple;
@@ -1100,7 +1100,7 @@ vac_truncate_clog(TransactionId frozenXID,
11001100
MultiXactIdPrecedes(lastSaneMinMulti,dbform->datminmxid))
11011101
bogus= true;
11021102

1103-
if (TransactionIdPrecedes(myXID,dbform->datfrozenxid))
1103+
if (TransactionIdPrecedes(nextXID,dbform->datfrozenxid))
11041104
frozenAlreadyWrapped= true;
11051105
elseif (TransactionIdPrecedes(dbform->datfrozenxid,frozenXID))
11061106
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp