Re: REPACK (CONCURRENTLY) can crash a logical decoding session

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>
Cc: Thom Brown <thom(at)linux(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Antonin Houska <ah(at)cybertec(dot)at>
Subject: Re: REPACK (CONCURRENTLY) can crash a logical decoding session
Date: 2026-09-08 21:12:44
Message-ID: CAD21AoCdrxX26j1cw1MDyVMy25F=hmnJTSrm0_S9cVnERwrH3w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Sep 6, 2026 at 9:18 AM Zhijie Hou (Fujitsu)
<houzj(dot)fnst(at)fujitsu(dot)com> wrote:
>
> Hi
>
> On Saturday, September 5, 2026 3:17 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> > I've attached the updated patches. I merged Antonin's two patches into one
> > with some cosmetic changes and the 0002 patch fixes issue (2).
> > Please review them.
>
> Both fixes look good to me. Just one question for the 0002.
>
> + /*
> + * Ignore update records without a new tuple. This happens when the
> + * caller of heap_update() asked for the change not to be decoded, as
> + * REPACK (CONCURRENTLY) does for the transient heap.
> + */
> + if (!(xlrec->flags & XLH_UPDATE_CONTAINS_NEW_TUPLE))
> + return;
>
> It seems to me that updates on catalog relations with no new tuple will also be
> skipped after this patch. I think that's fine, but perhaps we could mention this
> case in the comment to make the behavior clearer.

Good point. I've updated the comment accordingly and attached the
updated patches.

Also, I've fixed a whitespace issue in the 0001 patch.

Regards,

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

Attachment Content-Type Size
v3-0001-Fix-heap_update-ignoring-TABLE_UPDATE_NO_LOGICAL-.patch text/x-patch 6.5 KB
v3-0002-Fix-logical-decoding-to-ignore-updates-without-a-.patch text/x-patch 5.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-09-08 21:21:42 Re: Offline data checksum changes can cause incorrect checksum state on standbys
Previous Message Nathan Bossart 2026-09-08 20:58:25 Re: Speed up COPY FROM text/CSV parsing using SIMD