Move SLRU_PAGES_PER_SEGMENT to pg_config_manual.h

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Cc: Maxim Orlov <orlovmg(at)gmail(dot)com>, Daniil Davydov <3danissimo(at)gmail(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>
Subject: Move SLRU_PAGES_PER_SEGMENT to pg_config_manual.h
Date: 2025-11-10 11:29:08
Message-ID: c7a4ea90-9f7b-4953-81be-b3fcb47db057@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

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'm raising this in a new thread for visibility, in case someone who
hasn't been following the other threads have objections or better
suggestions.

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.

[1]
https://www.postgresql.org/message-id/CACG%3DezbZo_3_fnx%3DS5BfepwRftzrpJ%2B7WET4EkTU6wnjDTsnjg%40mail.gmail.com

[2]
https://www.postgresql.org/message-id/CAJDiXgiSVjsMj7pCKrXjwoVb2UCo28Fifd2VndNgybfbAhjbpg%40mail.gmail.com

- Heikki

Attachment Content-Type Size
0001-Move-SLRU_PAGES_PER_SEGMENT-to-pg_config_manual.h.patch text/x-patch 5.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2025-11-10 11:30:18 Re: Remove unused for_all_tables field from AlterPublicationStmt
Previous Message Álvaro Herrera 2025-11-10 11:27:03 Re: [PATCH] Add pg_get_tablespace_ddl() function to reconstruct CREATE TABLESPACE statement