RE: Newly created replication slot may be invalidated by checkpoint

From: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>
To: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: vignesh C <vignesh21(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Vitaly Davydov <v(dot)davydov(at)postgrespro(dot)ru>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, suyu(dot)cmj <mengjuan(dot)cmj(at)alibaba-inc(dot)com>, tomas <tomas(at)vondra(dot)me>, michael <michael(at)paquier(dot)xyz>, bharath(dot)rupireddyforpostgres <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Subject: RE: Newly created replication slot may be invalidated by checkpoint
Date: 2026-01-22 03:38:38
Message-ID: TY4PR01MB16907255419BF5373D54D5B869497A@TY4PR01MB16907.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wednesday, January 21, 2026 10:46 PM Kuroda, Hayato/黒田 隼人 <kuroda(dot)hayato(at)fujitsu(dot)com> wrote:
>
> I reproduced the issue by [1] and confirmed the issue was resolved by your
> patch. Here are my comments.
>
> 1.
> Replication slot cannot be invalidated even when only 0002 was applied. Can
> you
> modify the workload to cause invalidation without the fix? Or is it impossible?

It's possible to cause invalidation if we avoid interrupting the test by removing
the wait_for_log(), and I have done that in this version.

>
> 2.
> It might be matter of taste, but I do not like substituting to the argument;
> basically it's immutable. How about attached? It can indicate that minimum
> safe
> LSN would be used for the restart_lsn.
>

I think we can do that, but I would prefer to keep the current parameter name.
So, I've opted to simply move the LSN comparison to the right of the
slot.restart_lsn assignment.

Best Regards,
Hou zj

Attachment Content-Type Size
v2-0002-Add-a-tap-test-using-injection-point.patch application/octet-stream 4.5 KB
v2-0001-Fix-race-conditions-causing-invalidation-of-newly.patch application/octet-stream 8.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2026-01-22 03:49:37 Re: pg_upgrade: optimize replication slot caught-up check
Previous Message Fujii Masao 2026-01-22 03:24:37 Re: DOCS - "\d mytable" also shows any publications that publish mytable