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: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(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-01 10:45:54
Message-ID: CAFvd2n90JW8kJHc6ZZ6VdvfrqRyW+SP2PRcD0P3h69SFGKWKvQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Thu, Oct 1, 2026 at 2:39 PM Nisha Moond <nisha(dot)moond412(at)gmail(dot)com> wrote:
>
> Attached updated patches v5. There are a couple of optimizations and
> comment improvements in 002(testcode) too.

Thanks for the patch. It looks good to me overall, I just have coding
suggestions:

1.

Relation idxrel = index_open(idxoid, AccessShareLock);

We shall use NoLock here, since the index must have been locked already.

2.

+ for (int i = 0; i < idxrel->rd_index->indnkeyatts; i++)
+ {
+ AttrNumber attnum = idxrel->rd_index->indkey.values[i];
+
+ Assert(AttributeNumberIsValid(attnum));
+ indexbitmap = bms_add_member(indexbitmap,
+ attnum - FirstLowInvalidHeapAttributeNumber);
+ }

This Assert also looks unnecessary, removing it would make the code more
concise:

for (int i = 0; i < idxrel->rd_index->indnkeyatts; i++)
indexbitmap = bms_add_member(indexbitmap,
idxrel->rd_index->indkey.values[i] -
FirstLowInvalidHeapAttributeNumber);

The rest looks good to me.

Best Regards,
Zhijie Hou

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2026-10-01 10:53:20 Re: Publication DDL can race with a concurrent UPDATE
Previous Message Ashutosh Bapat 2026-10-01 10:34:36 Re: [PATCH] Two remaining shmem attachment issues in single-user mode