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

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: Vitaly Davydov <v(dot)davydov(at)postgrespro(dot)ru>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, tomas(at)vondra(dot)me
Subject: Re: Slot's restart_lsn may point to removed WAL segment after hard restart unexpectedly
Date: 2025-05-24 11:14:49
Message-ID: CAA4eK1+eebaviZ9TCU4DHAOZzRRbWe0HgdjjQ1VVu7P_pEsiYQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, May 24, 2025 at 4:08 PM Alexander Korotkov <aekorotkov(at)gmail(dot)com> wrote:
>
> I spend more time on this. The next revision is attached. It
> contains revised comments and other cosmetic changes. I'm going to
> backpatch 0001 to all supported branches,
>

Is my understanding correct that we need 0001 because
PhysicalConfirmReceivedLocation() doesn't save the slot to disk after
changing the slot's restart_lsn? If so, shouldn't the comments (One
could argue that the slot should be saved to disk now, but that'd be
energy wasted - the worst thing lost information could cause here is
to give wrong information in a statistics view) in
PhysicalConfirmReceivedLocation() be changed to mention the risk of
not saving the slot?

Also, after 0001, even the same solution will be true for logical
slots as well, where we are already careful to save the slot to disk
if its restart_lsn is changed, see LogicalConfirmReceivedLocation().
So, won't that effort be wasted? Even if we don't want to do anything
about it (which doesn't sound like a good idea), we should note that
in comments somewhere.

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2025-05-24 11:16:15 Re: Conflict detection for update_deleted in logical replication
Previous Message Alexander Korotkov 2025-05-24 10:37:52 Re: Slot's restart_lsn may point to removed WAL segment after hard restart unexpectedly