Re: Move SLRU_PAGES_PER_SEGMENT to pg_config_manual.h

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Maxim Orlov <orlovmg(at)gmail(dot)com>, Daniil Davydov <3danissimo(at)gmail(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>
Subject: Re: Move SLRU_PAGES_PER_SEGMENT to pg_config_manual.h
Date: 2025-11-10 12:13:20
Message-ID: 202511101133.zw2z6syvssd7@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2025-11-10 12:18:46 Re: Move SLRU_PAGES_PER_SEGMENT to pg_config_manual.h
Previous Message Amit Kapila 2025-11-10 12:10:14 Re: Issue with logical replication slot during switchover