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-11T17:08:38Z
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
Commits
-
Add warning to pg_controldata on PG_CONTROL_VERSION mismatch
- 6956bca515e2 19 (unreleased) landed
-
Add pg_resetwal and pg_controldata support for new control file field
- 676cd9ac0743 19 (unreleased) landed
-
Bump PG_CONTROL_VERSION for commit 3e0ae46d90
- e51037835854 19 (unreleased) landed
-
Move SLRU_PAGES_PER_SEGMENT to pg_config_manual.h
- 3e0ae46d907d 19 (unreleased) landed