Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5b2b444

Browse files
committed
Adjust OLDSERXID_MAX_PAGE based on BLCKSZ.
The value when BLCKSZ = 8192 is unchanged, but with larger-than-normal block sizes we might need to crank things back a bit, as we'll have more entries per page than normal in that case. Kevin Grittner
1 parent a195e3c commit 5b2b444

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/backend/storage/lmgr/predicate.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,13 @@ static SlruCtlData OldSerXidSlruCtlData;
305305
#define OLDSERXID_PAGESIZE BLCKSZ
306306
#define OLDSERXID_ENTRYSIZE sizeof(SerCommitSeqNo)
307307
#define OLDSERXID_ENTRIESPERPAGE (OLDSERXID_PAGESIZE / OLDSERXID_ENTRYSIZE)
308-
#define OLDSERXID_MAX_PAGE (SLRU_PAGES_PER_SEGMENT * 0x10000 - 1)
308+
309+
/*
310+
* Set maximum pages based on the lesser of the number needed to track all
311+
* transactions and the maximum that SLRU supports.
312+
*/
313+
#define OLDSERXID_MAX_PAGE Min(SLRU_PAGES_PER_SEGMENT * 0x10000 - 1, \
314+
(MaxTransactionId + 1) / OLDSERXID_ENTRIESPERPAGE - 1)
309315

310316
#define OldSerXidNextPage(page) (((page) >= OLDSERXID_MAX_PAGE) ? 0 : (page) + 1)
311317

0 commit comments

Comments
 (0)