Re: Resetting recovery target parameters in pg_createsubscriber - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Resetting recovery target parameters in pg_createsubscriber
Date
Msg-id aOM-T6iojyzb7OVB@paquier.xyz
Whole thread Raw
In response to RE: Resetting recovery target parameters in pg_createsubscriber  (Ilyasov Ian <ianilyasov@outlook.com>)
List pgsql-hackers
On Sun, Oct 05, 2025 at 10:30:53PM +0000, Ilyasov Ian wrote:
> Do we need info about recovery.conf here since patch applies only to
> master?

And actually, I think that you are pointing at a bug here.
pg_createsubscriber does updates of the control file but it includes
zero checks based on PG_CONTROL_VERSION to make sure that it is able
to work with a version compatible with what's on disk.  The CRC check
would be reported as incorrect after calling get_controlfile(), but
it's disturbing to claim that the control file looks corrupted.

So, oops?

[.. checks ..]

The last control file update has been done in 44fe30fdab67, and
attempting to run pg_createsubscriber on a v17 cluster leads to:
$ pg_createsubscriber -D $HOME/data/5433 -P "host=/tmp port=5432" -d postgres
pg_createsubscriber: error: control file appears to be corrupt

So, yes, oops.  We document that pg_cretesubscriber should have the
same major version as the source and target servers, which is good.
This error is no good, especially as checking it is just a few lines
of code, and that the take is actually PG_CONTROL_VERSION for control
file consistency.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: truncate_useless_pathkeys() doesn't account for window function queries
Next
From: shveta malik
Date:
Subject: Re: Clear logical slot's 'synced' flag on promotion of standby