Re: Session in aborted transaction misses effective_wal_level change - Mailing list pgsql-hackers

From Masahiko Sawada
Subject Re: Session in aborted transaction misses effective_wal_level change
Date
Msg-id CAD21AoDveNA7Aj95vAYuCXNdRuWejfifQ9tOkvza=kpeRR5mTQ@mail.gmail.com
Whole thread
In response to RE: Session in aborted transaction misses effective_wal_level change  ("Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>)
Responses Re: Session in aborted transaction misses effective_wal_level change
RE: Session in aborted transaction misses effective_wal_level change
List pgsql-hackers
On Sun, Oct 4, 2026 at 8:35 PM Hayato Kuroda (Fujitsu)
<kuroda.hayato@fujitsu.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

pgsql-hackers by date:

Previous
From: Alexander Lakhin
Date:
Subject: Re: [PATCH v1] Fix races in Windows pthread emulation
Next
From: Greg Burd
Date:
Subject: Re: Let an ordering index scan hand its ORDER BY value to the target list