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

From Alena Vinter
Subject Re: Resetting recovery target parameters in pg_createsubscriber
Date
Msg-id CAGWv16LeHght+1xKWF6T33pcveGXBCQuK+MpaJKezaD_AcXhPw@mail.gmail.com
Whole thread Raw
In response to Re: Resetting recovery target parameters in pg_createsubscriber  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers

Hi everyone,

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.

Robert, this scenario actually occurred in production at one of our customer environments. Even though this workflow may be uncommon, PostgreSQL should still handle it gracefully. The fact that the server can end up in a state where it cannot start because it fails to reach a recovery target point far in the past suggests a potential area for improvement in the recovery process. It would be helpful if the system could detect such a case — where the recovery target precedes the current consistent point — and either skip recovery or emit a clear diagnostic message rather than failing to start.

Best regards,
Vinter Alena

Attachment

pgsql-hackers by date:

Previous
From: Pradeep Kumar
Date:
Subject: Re: Assertion failure in SnapBuildInitialSnapshot()
Next
From: Amit Kapila
Date:
Subject: Re: POC: enable logical decoding when wal_level = 'replica' without a server restart