Re: Move SLRU_PAGES_PER_SEGMENT to pg_config_manual.h

Heikki Linnakangas <hlinnaka@iki.fi>

From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Álvaro Herrera <alvherre@kurilemu.de>, Daniel Gustafsson <daniel@yesql.se>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>, Maxim Orlov <orlovmg@gmail.com>, Daniil Davydov <3danissimo@gmail.com>
Date: 2025-11-10T17:46:37Z
Lists: pgsql-hackers

Attachments

On 10/11/2025 18:38, Heikki Linnakangas wrote:
> On 10/11/2025 17:16, Tom Lane wrote:
>> Heikki Linnakangas <hlinnaka@iki.fi> writes:
>>> Committed. Thanks for the quick review!
>>
>> I think the number this should have bumped is PG_CONTROL_VERSION
>> (thanks to the new field therein).  Bumping CATALOG_VERSION_NO
>> seems quite beside the point.
> 
> Ah thanks, I forgot we have that as a separate version number. I'll go 
> bump that now. (I will not try to revert the CATALOG_VERSION_NO change, 
> that would be very confusing.)

Fixed. And I just noticed another thing I forgot: pg_resetwal and 
pg_controldata.

While testing, I noticed that pg_controldata doesn't check 
PG_CONTROL_VERSION. If you add a field to ControlFileData that changes 
the length, you'll get a warning that the CRC doesn't match:

> pg_controldata: warning: calculated CRC checksum does not match value stored in control file
> pg_controldata: detail: Either the control file is corrupt, or it has a different layout than this program is expecting.  The results below are untrustworthy.

but if you make any changes that *don't* change ControlFileData's size, 
pg_controldata will merrily try to interpret the values with no warning. 
Surely it should also check PG_CONTROL_VERSION?

- Heikki

Commits

  1. Add warning to pg_controldata on PG_CONTROL_VERSION mismatch

  2. Add pg_resetwal and pg_controldata support for new control file field

  3. Bump PG_CONTROL_VERSION for commit 3e0ae46d90

  4. Move SLRU_PAGES_PER_SEGMENT to pg_config_manual.h