Re: Move SLRU_PAGES_PER_SEGMENT to pg_config_manual.h - Mailing list pgsql-hackers

From Álvaro Herrera
Subject Re: Move SLRU_PAGES_PER_SEGMENT to pg_config_manual.h
Date
Msg-id 202511101133.zw2z6syvssd7@alvherre.pgsql
Whole thread Raw
In response to Move SLRU_PAGES_PER_SEGMENT to pg_config_manual.h  (Heikki Linnakangas <hlinnaka@iki.fi>)
Responses Re: Move SLRU_PAGES_PER_SEGMENT to pg_config_manual.h
List pgsql-hackers
On 2025-Nov-10, Heikki Linnakangas wrote:

> At the "make mxidoff 64 bits" thread [1], we're discussing moving
> SLRU_PAGES_PER_SEGMENT to pg_config_manual.h, to make it accessible from
> pg_upgrade code. It's currently defined in slru.h, which cannot be included
> in frontend code. There are many ways we could fix that, but moving
> SLRU_PAGES_PER_SEGMENT to pg_config_manual.h seems best to me. Patch
> attached.

Seems reasonable to me.

> There was a suggestion earlier to make SLRU_PAGES_PER_SEGMENT a configure
> option [2]. I don't want to go that far; pg_config_manual.h seems like the
> right level of configurability to me.

I agree.

> The patch does not move over this comment from slru.h:
> 
> > - * Note: because TransactionIds are 32 bits and wrap around at 0xFFFFFFFF,
> > - * page numbering also wraps around at 0xFFFFFFFF/xxxx_XACTS_PER_PAGE (where
> > - * xxxx is CLOG or SUBTRANS, respectively), and segment numbering at
> > - * 0xFFFFFFFF/xxxx_XACTS_PER_PAGE/SLRU_PAGES_PER_SEGMENT.  We need
> > - * take no explicit notice of that fact in slru.c, except when comparing
> > - * segment and page numbers in SimpleLruTruncate (see PagePrecedes()).
> 
> I left it out because there's already a copy of the same comment next to
> CLOG_XACTS_PER_PAGE and SUBTRANS_XACTS_PER_PAGE. That seems enough.

I agree -- this comment would be out of place in pg_config_manual.h.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"I am amazed at [the pgsql-sql] mailing list for the wonderful support, and
lack of hesitasion in answering a lost soul's question, I just wished the rest
of the mailing list could be like this."                               (Fotis)
              https://postgr.es/m/200606261359.k5QDxE2p004593@auth-smtp.hol.gr



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Issue with logical replication slot during switchover
Next
From: Heikki Linnakangas
Date:
Subject: Re: Move SLRU_PAGES_PER_SEGMENT to pg_config_manual.h