Re: Slot's restart_lsn may point to removed WAL segment after hard restart unexpectedly

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Cc: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Vitaly Davydov <v(dot)davydov(at)postgrespro(dot)ru>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alexander Lakhin <exclusion(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, "tomas(at)vondra(dot)me" <tomas(at)vondra(dot)me>, vignesh C <vignesh21(at)gmail(dot)com>
Subject: Re: Slot's restart_lsn may point to removed WAL segment after hard restart unexpectedly
Date: 2025-06-25 21:50:29
Message-ID: CAPpHfdsbjXd_iXQwOTS3iioyEmuNz3HdQG8E8tHB0LodN=RXLQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 25, 2025 at 11:25 AM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
> On Wed, Jun 25, 2025 at 1:18 PM Hayato Kuroda (Fujitsu)
> <kuroda(dot)hayato(at)fujitsu(dot)com> wrote:
> > Another idea is to call ReplicationSlotsComputeRequiredLSN() when at least one
> > of the restart_lsn is updated, like attached. I feel this could reduce the computation
> > bit more.
>
> Right, that makes sense, if there is nothing updated on disk then we
> can avoid computing this.

Good idea. But I think we should associate the "updated" flag
directly to the fact that one slot (no matter logical or physical)
changed its last_saved_restart_lsn. See the attached patch. I'm
going to push it if no objections.

------
Regards,
Alexander Korotkov
Supabase

Attachment Content-Type Size
v1-0001-Fix-CheckPointReplicationSlots-with-max_replicati.patch application/octet-stream 2.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2025-06-25 21:50:33 Re: Huge commitfest app update upcoming: Tags, Draft CF, Help page, and automated commitfest creat/open/close
Previous Message Peter Geoghegan 2025-06-25 21:44:22 Re: Making Row Comparison NULL row member handling more robust during skip scans