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-11 17:08:38
Message-ID: 2765ae60-5868-44ee-82e1-4d8576d2e934@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/11/2025 19:46, Heikki Linnakangas wrote:
> Fixed. And I just noticed another thing I forgot: pg_resetwal and
> pg_controldata.

Fixed that.

> 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?

Committed an additional version check to pg_controldata. It now gives a
a more explicit warning than just checksum failure if the version in the
control file doesn't match the PG_CONTROL_VERSION that the binary was
built with:

> ~/git-sandbox-pgsql/master$ ./src/bin/pg_controldata/pg_controldata -D ~/pgsql.18stable/data
> pg_controldata: warning: control file version (1800) does not match the version understood by this program (1900)
> pg_controldata: detail: Either the control file has been created with a different version of PostgreSQL, or it is corrupt. The results below are untrustworthy.
> pg_controldata: warning: invalid WAL segment size in control file (64 bytes)
> pg_controldata: detail: The WAL segment size must be a power of two between 1 MB and 1 GB.
> pg_controldata: detail: The file is corrupt and the results below are untrustworthy.
> pg_control version number: 1800
> Catalog version number: 202506291
> Database system identifier: 7571514922284774749
> Database cluster state: shut down
> pg_control last modified: Tue 11 Nov 2025 19:04:53 EET
> ...

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2025-11-11 18:48:39 Re: Trigger more frequent autovacuums of heavy insert tables
Previous Message Dean Rasheed 2025-11-11 16:59:55 Re: minor error message enhance: print RLS policy name when only one permissive policy exists