Re: Move SLRU_PAGES_PER_SEGMENT to pg_config_manual.h

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Daniel Gustafsson <daniel(at)yesql(dot)se>, "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>
Subject: Re: Move SLRU_PAGES_PER_SEGMENT to pg_config_manual.h
Date: 2025-11-10 17:46:37
Message-ID: 2afded89-f9f0-4191-84d8-8b8668e029a1@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/11/2025 18:38, Heikki Linnakangas wrote:
> On 10/11/2025 17:16, Tom Lane wrote:
>> Heikki Linnakangas <hlinnaka(at)iki(dot)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

Attachment Content-Type Size
0001-Add-missing-pg_resetwal-and-pg_control-data-support-.patch text/x-patch 2.0 KB
0002-Add-warning-to-pg_controldata-on-PG_CONTROL_VERSION-.patch text/x-patch 1.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2025-11-10 18:05:14 Re: Improve LWLock tranche name visibility across backends
Previous Message Tom Lane 2025-11-10 17:36:14 Re: Move SLRU_PAGES_PER_SEGMENT to pg_config_manual.h