Re: Disabled logical replication origin session causes primary key errors

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Shawn McCoy <shawn(dot)the(dot)mccoy(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>, "drewwcallahan(at)gmail(dot)com" <drewwcallahan(at)gmail(dot)com>, "scott(at)meads(dot)us" <scott(at)meads(dot)us>
Subject: Re: Disabled logical replication origin session causes primary key errors
Date: 2025-04-21 17:00:05
Message-ID: CAD21AoCcO1QknzcumBNT-HWnb5cKkszzDQv2+Yv71sj9mk75xg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Apr 21, 2025 at 3:08 AM Hayato Kuroda (Fujitsu)
<kuroda(dot)hayato(at)fujitsu(dot)com> wrote:
>
> Dear members,
>
> Thanks for reporting the issue.
>
> > Right. We have wrongly assumed in that commit that the apply worker
> > will exit after an ERROR, but as shown by this case, the ERROR could
> > be silently handled. So, +1, for moving replication origin reset to
> > PG_CATCH in start_apply.
>
> I was an author of original commit, so let me take initiative. When I was working
> for 3f28b2fcac, I could not find path which ERROR is reported but worker can
> survive so that I added replorigin_reset() in apply_error_callback(). The reported
> case, however, the exception could be raised but the insert itself is committed.
> In this case worker can continue working.
>
> Attached patches have proposed changes. I did 1) meson test, 2) workloads provided
> in [1], and 3) manual tests done in original thread [2], and all of them could be
> passed. The version is 2 because of the self-reviewing.
>
> One note is that geterrlevel() is removed for HEAD patch but retained for PG16/PG17.
> The function is exported, and APIs cannot be changed in back branches.

Thank you for the patch. The changes look reasonable to me. Can we add
some regression tests for that?

Regards,

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2025-04-21 17:08:05 Re: Command order bug in pg_dump
Previous Message vignesh C 2025-04-21 16:17:12 Re: Disabled logical replication origin session causes primary key errors