aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2011-07-07 15:05:21 -0400
committerRobert Haas <rhaas@postgresql.org>2011-07-07 15:05:21 -0400
commit5b2b444f66363ee4132b9e398c0535fa59765a63 (patch)
tree684f902e8ce5d8dfb2c52b9408fe2317134b9ca4 /src
parenta195e3c34f1eeb6a607c342121edf48e49067ea9 (diff)
downloadpostgresql-5b2b444f66363ee4132b9e398c0535fa59765a63.tar.gz
postgresql-5b2b444f66363ee4132b9e398c0535fa59765a63.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/backend/storage/lmgr/predicate.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c
index f0c8ee48c34..7f6dcbb6ca6 100644
--- a/src/backend/storage/lmgr/predicate.c
+++ b/src/backend/storage/lmgr/predicate.c
@@ -305,7 +305,13 @@ static SlruCtlData OldSerXidSlruCtlData;
#define OLDSERXID_PAGESIZE BLCKSZ
#define OLDSERXID_ENTRYSIZE sizeof(SerCommitSeqNo)
#define OLDSERXID_ENTRIESPERPAGE (OLDSERXID_PAGESIZE / OLDSERXID_ENTRYSIZE)
-#define OLDSERXID_MAX_PAGE (SLRU_PAGES_PER_SEGMENT * 0x10000 - 1)
+
+/*
+ * Set maximum pages based on the lesser of the number needed to track all
+ * transactions and the maximum that SLRU supports.
+ */
+#define OLDSERXID_MAX_PAGE Min(SLRU_PAGES_PER_SEGMENT * 0x10000 - 1, \
+ (MaxTransactionId + 1) / OLDSERXID_ENTRIESPERPAGE - 1)
#define OldSerXidNextPage(page) (((page) >= OLDSERXID_MAX_PAGE) ? 0 : (page) + 1)