RE: pg_copy_logical_replication_slot doesn't copy the failover property

From: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, "duffieldzane(at)gmail(dot)com" <duffieldzane(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: pg_copy_logical_replication_slot doesn't copy the failover property
Date: 2025-02-24 10:58:52
Message-ID: OS0PR01MB57163CBD6956290425B5541A94C02@OS0PR01MB5716.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers

On Monday, February 24, 2025 10:46 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:

(The previous email was blocked, here is another attempt)

>
> On Sat, Feb 22, 2025 at 11:26 AM Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>
> wrote:
> >
> > Adding Amit to the thread.
> >
>
> Thanks.
>
> Looking at the original complaint:
>
> > It says
> > * To avoid potential issues with the slot synchronization
> where the
> > * restart_lsn of a replication slot can go backward, we set
> the
> > * failover option to false here. This situation occurs when
> a slot
> > * on the primary server is dropped and immediately
> replaced with a
> > * new slot of the same name, created by copying from
> another existing
> > * slot. However, the slot synchronization will only observe
> the
> > * restart_lsn of the same slot going backward.
>
> It would be better to update the comments as well to make the potential issues
> with slot synchronization clear or mention the reference of other place where
> we have comments related to this race condition. Also, I think it is better to
> write about two_phase in the comments as well as in docs unless already
> mentioned. If you agree with updating the comments as well, shall we redirect
> this to hackers?

(Redirect to -hackers)

>
> > >
> > > IIUC the two_phase field is also not copied from the source slot. I
> > > think we can clarify in the doc that these two fields are not copied.
> > >
>
> +1.

Here is the new V3 patch set which updated the comments to make the
issue clearer.

After thinking more on the two_phase option, I didn't find an issue that prevent
us from copying its option value. So, it’s more intuitive to me to just
copy its value instead of adding doc for it. The 0002 includes the same and I will
keep testing to ensure there are no other issues missed.

Best Regards,
Hou zj

Attachment Content-Type Size
v3-0001-Improve-the-documentation-for-pg_copy_logical_rep.patch application/octet-stream 3.2 KB
v3-0002-Copy-the-two_phase-option-in-pg_copy_logical_repl.patch application/octet-stream 8.5 KB

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Amit Kapila 2025-02-25 05:31:56 Re: pg_copy_logical_replication_slot doesn't copy the failover property
Previous Message PG Doc comments form 2025-02-24 06:52:25 correction

Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema-Nio 2025-02-24 10:58:53 Re: Bump soft open file limit (RLIMIT_NOFILE) to hard limit on startup
Previous Message Alexander Korotkov 2025-02-24 10:57:41 Re: Removing unneeded self joins