Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> Well, as long as we can verify that OLDSERXID_MAX_PAGE has the
> same value for BLCKSZ=8K before and after this patch, I don't see
> any real downside to applying it. If, hypothetically, it's buggy,
> it's only going to break things for non-default block sizes which
> are, by your description, not correct right now anyway.
Outside of a code comment, the entire patch consists of replacing
the definition of the OLDSERXID_MAX_PAGE macro. The old definition
is:
(SLRU_PAGES_PER_SEGMENT * 0x10000 - 1)
SLRU_PAGES_PER_SEGMENT is define to be 32. So this is:
(32 * 0x10000) - 1 = 2097151
The new definition is the min of the old one and a value based on
BLCKSZ:
(MaxTransactionId + 1) / OLDSERXID_ENTRIESPERPAGE - 1)
Where "entries per page" is BLCKSZ / sizeof(uint64).
For an 8K BLCKSZ this is:
((0xffffffff + 1) / 1024) - 1 = 4194303
So the macro is guaranteed to have the same value as it currently
does for BLCKSZ of 16KB or lower.
-Kevin