Re: Session in aborted transaction misses effective_wal_level change

From: Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Sergei Patiakin <sergei(dot)patiakin(at)enterprisedb(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, msawada(at)postgresql(dot)org
Subject: Re: Session in aborted transaction misses effective_wal_level change
Date: 2026-10-02 18:29:05
Message-ID: CANhcyEVmJ2vuS-h=o8PqaGBcv=f_TQAQVVBE3sRMnfjHmS64rg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 1 Oct 2026 at 08:56, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>
> Hi,
>
> On Wed, Sep 30, 2026 at 10:19 AM Sergei Patiakin
> <sergei(dot)patiakin(at)enterprisedb(dot)com> wrote:
> >
> > For an aborted transaction, there is today a gap between the
> > AtEOXact_LogicalCtl call and the XID being cleared. If an
> > effective_wal_level change occurs during that gap, the change will be
> > missed. That means the next transaction on that session will not be
> > logically decoded.
> >
> > Attaching a reproducer bash script that demonstrates the missing decoded change.
> > Attaching a fix that moves the AtEOXact_LogicalCtl call later, closing the gap.
>
> Thank you for the report. I agree it's an issue that we should fix for v19.
>
> The fix looks good to me. We need to check and update XLogLogicalInfo
> in every place where we reset the top-level transaction id.
>
> I've updated the patch with the regression tests. Please review it.

Hi Sawada-san, Sergei,

I am able to reproduce the issue on HEAD and PG19.
The patch applies on both the branches and it addresses the issue.

Just a minor comment, the patch requires a pgperltidy run. Otherwise patch LGTM.

Thanks,
Shlok Kyal

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2026-10-02 18:30:33 Re: BUG #19686: Rolling back SET TABLESPACE
Previous Message Andres Freund 2026-10-02 18:05:20 Re: Throwing away unnecessary spin-locks