Re: Fix apply worker crash when subscriber table has only a deferrable primary key

From: Zhijie Hou <houzhijie22(at)gmail(dot)com>
To: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix apply worker crash when subscriber table has only a deferrable primary key
Date: 2026-10-05 07:38:30
Message-ID: CAFvd2n9B8mRFQmhWXrbw0Bk6Q2YA2heiftp=DOpKTjYT1m7bOg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Mon, Oct 5, 2026 at 12:30 PM Nisha Moond <nisha(dot)moond412(at)gmail(dot)com> wrote:
>
> On Sat, Oct 3, 2026 at 2:15 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> > On Thu, Oct 1, 2026 at 11:33 PM Zhijie Hou <houzhijie22(at)gmail(dot)com> wrote:
> > >
> > > I merged a deferrable key test from 0002 into 0001 in this version.
> > >
> > > Here is the V7 patch that addressed above comments. I confirmed it applies
> > > cleanly on all required branches and the test passed.
> > >
> >
> > Thanks, I've pushed the patch.
> >
>
> Thanks for pushing the patch.
> Here is the rebased v4 patch for the remaining issue in this thread.

I confirmed the patch fixes the issue.

I initially had a concern while reviewing the code: there might be a risk that
the index fetched via the RelationGetxxx() function is inconsistent with the
computed and cached localindexoid. After testing, I don't think this can
happen, because no invalidations can be processed between
FindLogicalRepLocalIndex() and logicalrep_rel_mark_updatable() so even if the
index is dropped concurrently in between, it won't cause real issues.

That said, even if there's no race here, would it be better to simply use the
computed localindexoid for the updatable check rather than fetching it from
relcache again? I think that would make the code simpler and safer. I'm sharing
a small top-up patch for reference.

Best Regards,
Zhijie Hou

Attachment Content-Type Size
vTopup-0001-Use-computed-index-to-check.patch application/octet-stream 3.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stefan Guha 2026-10-05 08:10:52 Re: Planning time quadratic in the IN-list length for "c = X AND (a, b) IN (...)" with BitmapOr
Previous Message Sebas Mannem 2026-10-05 07:06:24 Re: NOT NULL NOT ENFORCED