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

Commita34c3dd

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 parente504d91 commita34c3dd

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
@@ -1050,7 +1050,7 @@ vac_truncate_clog(TransactionId frozenXID,
10501050
TransactionIdlastSaneFrozenXid,
10511051
MultiXactIdlastSaneMinMulti)
10521052
{
1053-
TransactionIdmyXID=GetCurrentTransactionId();
1053+
TransactionIdnextXID=ReadNewTransactionId();
10541054
Relationrelation;
10551055
HeapScanDescscan;
10561056
HeapTupletuple;
@@ -1099,7 +1099,7 @@ vac_truncate_clog(TransactionId frozenXID,
10991099
MultiXactIdPrecedes(lastSaneMinMulti,dbform->datminmxid))
11001100
bogus= true;
11011101

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp