Re: Resetting recovery target parameters in pg_createsubscriber

From: Alena Vinter <dlaaren8(at)gmail(dot)com>
To: Ilyasov Ian <ianilyasov(at)outlook(dot)com>
Cc: "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-10-06 06:25:12
Message-ID: CAGWv16LPtKym0kBW-hsYe7XMm9j1+1ap0jga+QarW4Ku1oV13g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi everyone,

Thank you for all the valuable feedback! I've improved the patches in the
latest version.

> Based on the contents of the latest patch, we reset the parameters
> after promoting the node, and primary_conninfo only matters while we
> are in recovery, for a standby recovery WAL using the streaming
> replication protocol.

Michael, thanks for helping! This fact simplifies the code. I put resetting
the parameters exclusively in the `atexit` callback -- this approach seems
neater to me. What do you think?

> Did I get the idea right?

Ian, yes, you got it right. The core issue occurs when postgres encounters
a checkpoint during recovery, determines redo isn't needed (because there
are no records after the checkpoint), but then fails with a fatal error
because it cannot reach the specified LSN target (which is lower than the
checkpoint LSN). I reckon this is a recovery logic issue, but I also
believe the component that sets recovery parameters should be responsible
for cleaning them up when they're no longer required.

Best wishes,
Alena Vinter

Attachment Content-Type Size
v7-0003-doc-Add-warning-about-leftover-recovery-parameters-i.patch text/x-patch 1.9 KB
v7-0002-Reseting-recovery-target-parameters-in-pg_createsubs.patch text/x-patch 6.2 KB
v7-0001-Implements-helper-function-in-recovery_gen.patch text/x-patch 4.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-10-06 06:33:41 Re: Add stats_reset to pg_stat_all_tables|indexes and related views
Previous Message vignesh C 2025-10-06 06:19:52 Re: Logical Replication of sequences