Re: logical replication: restart_lsn can go backwards (and more), seems broken since 9.4

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Tomas Vondra <tomas(at)vondra(dot)me>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: logical replication: restart_lsn can go backwards (and more), seems broken since 9.4
Date: 2024-11-14 01:37:40
Message-ID: CAD21AoAGM3z6N8zW9SRqJoB9P5c0pW+LaGR2xsRZ3MH0+vgdBA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Nov 13, 2024 at 3:47 PM Tomas Vondra <tomas(at)vondra(dot)me> wrote:
>
>
>
> On 11/14/24 00:33, Masahiko Sawada wrote:
> > On Wed, Nov 13, 2024 at 3:53 AM Tomas Vondra <tomas(at)vondra(dot)me> wrote:
> >>
> >>
> >>
> >> On 11/13/24 10:38, Amit Kapila wrote:
> >>> On Tue, Nov 12, 2024 at 6:29 PM Tomas Vondra <tomas(at)vondra(dot)me> wrote:
> >>>>
> >>>> Sure, maybe fixing LogicalIncreaseRestartDecodingForSlot() is enough to
> >>>> fix this particular case. But I'd be happier if we could also add
> >>>> asserts checking the LSN advances, to detect similar issues that we may
> >>>> be unaware of yet.
> >>>>
> >>>
> >>> As most of us lean towards fixing
> >>> LogicalIncreaseRestartDecodingForSlot(), let's fix that in the HEAD
> >>> and back branches. Separately we can consider other asserts just for
> >>> HEAD that you think will make the code robust and help avoid such bugs
> >>> in the future.
> >>>
> >>
> >> +1 to that
> >>
> >
> > +1.
> >
> > Tomas, are you going to update the patch you shared before[1] or shall I?
> >
>
> Please feel free to take over. I'm busy with some other stuff and the
> initial analysis was done by you anyway.

Sure. I've attached the updated patch. I just added the commit message.

Regards,

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v1-0001-Fix-a-possibility-of-logical-replication-slot-s-r.patch application/octet-stream 3.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2024-11-14 01:54:06 Re: On non-Windows, hard depend on uselocale(3)
Previous Message Richard Guo 2024-11-14 01:20:14 Re: Some dead code in get_param_path_clause_serials()