Re: Resetting recovery target parameters in pg_createsubscriber

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Alena Vinter <dlaaren8(at)gmail(dot)com>
Cc: Andrey Rudometov <unlimitedhikari(at)gmail(dot)com>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, 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: 2026-01-08 01:20:32
Message-ID: aV8GYDrto1hVYj-d@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 05, 2026 at 03:33:17PM +0900, Michael Paquier wrote:
> It seems roughly OK, so I have put my hands on it. A couple of notes
> regarding the things done in the updated version attached:
> - Addition of two tests to check pg_createsubscriber.conf.disabled in
> the data folders of node S and K.
> - More description in the tests.
> - The "dry run mode" node has disappeared from the recovery parameter
> StringInfo, so added it back at the top of the parameters generated.
> - Missing a newline after the include_if_exists.
> - dirable_rename() logs already something on failure, I see no need
> for an extra warning to say the same. Adding the warning telling that
> a manual intervention may be required is good, though.
> - Let's group the document change with the main patch.
> - More stylistic changes, comments and code.
> - The new test fails if we undo the changes in pg_createsubscriber.c,
> as we'd want, in the shape of node K FATAL-ing due to an incorrect
> recovery configuration fed to the node.

After a second round of review, there was still an issue here: the LSN
returned by create_logical_replication_slot() could be NULL in
dry-run mode, and the code sets recovery_target_lsn to
InvalidXLogRecPtr in the recovery configuration printed out, meaning a
NULL pointer dereference. I have switched the patch to do what
happens on HEAD: InvalidXLogRecPtr for the dry-run mode. That also
leads to less diffs. And done.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Jackson 2026-01-08 01:31:44 Re: Proposal: Add a UNIQUE NOT ENFORCED constraint
Previous Message Chao Li 2026-01-08 01:15:31 Re: Refactor replication origin state reset helpers