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

From: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>
To: Zhijie Hou <houzhijie22(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 12:12:25
Message-ID: CABdArM4=Lgmj1Ab2xEXLCFmhJuf+wOppO8UTRU9HWVQbj5uKUw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 1, 2026 at 4:16 PM Zhijie Hou <houzhijie22(at)gmail(dot)com> wrote:
>
> 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.
>

Makes sense, the index is always already locked when we get here. I
also added a comment.

>
> 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);
>

Done.

--
Thanks,
Nisha

Attachment Content-Type Size
v6-0001-Use-the-relation-map-s-index-when-searching-delet.patch application/octet-stream 7.2 KB
v6-0002-Add-TAP-tests-for-update_deleted-detection-by-seq.patch application/octet-stream 8.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Shinya Kato 2026-10-01 12:20:14 Re: Report oldest xmin source when autovacuum cannot remove tuples
Previous Message Tatsuya Kawata 2026-10-01 12:07:11 Re: [PATCH] Add memory/disk usage for Function Scan nodes in EXPLAIN