Re: Resetting recovery target parameters in pg_createsubscriber

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Ilyasov Ian <ianilyasov(at)outlook(dot)com>
Cc: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, "dlaaren8(at)gmail(dot)com" <dlaaren8(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Resetting recovery target parameters in pg_createsubscriber
Date: 2025-10-06 03:58:07
Message-ID: aOM-T6iojyzb7OVB@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2025-10-06 04:12:57 Re: Clear logical slot's 'synced' flag on promotion of standby
Previous Message David Rowley 2025-10-06 03:42:45 truncate_useless_pathkeys() doesn't account for window function queries