Skip to content

Commit f7feb02

Browse files
committed
Fix GetNewTransactionId()'s interaction with xidVacLimit.
Commit ad30805 switched to returning a FullTransactionId, but failed to load the potentially updated value in the case where xidVacLimit is reached and we release and reacquire the lock. Repair, closing bug #15727. While reviewing that commit, also fix the size computation used by EstimateTransactionStateSize() and switch to the mul_size() macro traditionally used in such expressions. Author: Thomas Munro Reported-by: Roman Zharkov Discussion: https://postgr.es/m/15727-0be246e7d852d229%40postgresql.org
1 parent d87ab88 commit f7feb02

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/backend/access/transam/varsup.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ GetNewTransactionId(bool isSubXact)
159159

160160
/* Re-acquire lock and start over */
161161
LWLockAcquire(XidGenLock, LW_EXCLUSIVE);
162-
xid = XidFromFullTransactionId(ShmemVariableCache->nextFullXid);
162+
full_xid = ShmemVariableCache->nextFullXid;
163+
xid = XidFromFullTransactionId(full_xid);
163164
}
164165

165166
/*

src/backend/access/transam/xact.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5151,7 +5151,7 @@ EstimateTransactionStateSpace(void)
51515151
nxids = add_size(nxids, s->nChildXids);
51525152
}
51535153

5154-
return add_size(size, sizeof(SerializedTransactionState) * nxids);
5154+
return add_size(size, mul_size(sizeof(TransactionId), nxids));
51555155
}
51565156

51575157
/*

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