Heikki Linnakangas <heikki.linnakan...@enterprisedb.com> wrote: > On 08.07.2011 15:22, Kevin Grittner wrote: >> MaxTransactionId / OLDSERXID_ENTRIESPERPAGE > > Hmm, that seems more correct to me anyway. We are trying to > calculate which page xid MaxTransactionId would be stored on, if > the SLRU didn't have a size limit. You calculate that with simply > MaxTransactionId / OLDSERXID_ENTRIESPERPAGE. Good point. The old calculation was finding the page before the page which would contain the first out-of-bound entry. As long as these numbers are all powers of 2 that's the same, but (besides the overflow issue) it's not as clear. On the off chance that this saves someone any work, trivial patch attached. -Kevin
*** a/src/backend/storage/lmgr/predicate.c --- b/src/backend/storage/lmgr/predicate.c *************** *** 311,317 **** static SlruCtlData OldSerXidSlruCtlData; * 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) --- 311,317 ---- * transactions and the maximum that SLRU supports. */ #define OLDSERXID_MAX_PAGE Min(SLRU_PAGES_PER_SEGMENT * 0x10000 - 1, \ ! MaxTransactionId / OLDSERXID_ENTRIESPERPAGE) #define OldSerXidNextPage(page) (((page) >= OLDSERXID_MAX_PAGE) ? 0 : (page) + 1)
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers