Re: Session in aborted transaction misses effective_wal_level change

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
Cc: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Sergei Patiakin <sergei(dot)patiakin(at)enterprisedb(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "msawada(at)postgresql(dot)org" <msawada(at)postgresql(dot)org>
Subject: Re: Session in aborted transaction misses effective_wal_level change
Date: 2026-10-05 18:01:50
Message-ID: CAD21AoDveNA7Aj95vAYuCXNdRuWejfifQ9tOkvza=kpeRR5mTQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Oct 4, 2026 at 8:35 PM Hayato Kuroda (Fujitsu)
<kuroda(dot)hayato(at)fujitsu(dot)com> wrote:
>
> Dear Bertrand, Sawada-san,
>
> > I wonder if it wouldn't make more sense to keep this after
> > XactTopFullTransactionId
> > is reset, as in v1?
> >
> > Indeed, couldn't a barrier be processed during AtCleanup_Memory(), while the
> > XID is still valid, and set XLogLogicalInfoUpdatePending again after this call?
>
> Per my research the function calls MemoryContextCallResetCallbacks(), which can
> calls the arbitrary functions from core and extensions. So It's possible that a
> random callback calls CHECK_FOR_INTERRUPTS() and consumes a barrier.
>
> I still prefer to put after resetting the XactTopFullTransactionId.
>

Thank you for the comments. I'm now convinced that we can call it
after resetting the top-level XID. I was concerned about the
inconsistency between the AtEOXact_LogicalCtl() calls in
CommitTransaction() and CleanupTransaction(), but it's fine for them
to differ, since we're holding interrupts in the former but not in the
latter. Calling AtEOXact_LogicalCtl() after resetting the top-level
XID would be more bullet-proof, so let's go with this approach.

I've attached the updated patch. Please review it.

Regards,

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

Attachment Content-Type Size
v3-0001-Fix-deferred-XLogLogicalInfo-update-after-a-faile.patch text/x-patch 5.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Burd 2026-10-05 18:14:37 Re: Let an ordering index scan hand its ORDER BY value to the target list
Previous Message Alexander Lakhin 2026-10-05 18:00:00 Re: [PATCH v1] Fix races in Windows pthread emulation