Re: Resetting recovery target parameters in pg_createsubscriber

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Alena Vinter <dlaaren8(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Ilyasov Ian <ianilyasov(at)outlook(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Resetting recovery target parameters in pg_createsubscriber
Date: 2025-11-03 21:27:59
Message-ID: CAPpHfdt88BQyuT3pRqouk+1Lsosa9_Orwt6eVTCUiDa9C89_bA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 27, 2025 at 2:22 PM Alena Vinter <dlaaren8(at)gmail(dot)com> wrote:
> Michael, thank you for outlining your alternative approach.
> After rethinking the current patch state with a clearer vision, I realized that simply truncating the postgresql.auto.conf file is sufficient. All modifications made by pg_createsubscriber in this file are append-only, so truncation reliably restores it to its original state without adding extra logic. This keeps the patch small and clean.
>
> For older versions using recovery.conf, the situation differs — since that file is fully rewritten during recovery setup, we instead restore the previously saved original file using a durable rename.
>
> Regarding debugging: the contents are not entirely lost. pg_createsubscriber already prints the new recovery configuration as debug output, so the full parameter set remains visible in the logs for inspection when needed. My point is that adding include directives isn't needed, as we already have debug output, and, moreover, they aren't applied to recovery.conf.

I have rechecked this. It appears that pg_createsubscriber writes the
recovery configuration to the output and only in verbose mode. So,
it's far no guaranteed that this information would be accessible. One
may run pg_createsubscriber not in verbose mode or don't save its
output. I suggest we should re-implement this in a way Michael
proposed [1]: save the configuration to pg_createsubscriber.conf.old
file.

Links.
1. https://www.postgresql.org/message-id/aOZOJ8p8LEcw0SpH%40paquier.xyz

------
Regards,
Alexander Korotkov
Supabase

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2025-11-03 21:32:46 Re: Use stack-allocated StringInfoData
Previous Message Tom Lane 2025-11-03 20:53:29 Re: psql --help=variables missing csv_fieldsep