| From: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
|---|---|
| To: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com> |
| Cc: | Zhijie Hou <houzhijie22(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Fix LogStandbySnapshot() race during logical decoding activation |
| Date: | 2026-11-25 20:02:54 |
| Message-ID: | CAD21AoC2jXN2J711f8G5LwrAtHhcm2VrPBtn_bpVq2Zh3N_tzg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Nov 24, 2026 at 9:07 PM Hayato Kuroda (Fujitsu)
<kuroda(dot)hayato(at)fujitsu(dot)com> wrote:
>
> Hi,
>
> > > Quick (and possibly stupid) question. Is there a reason why
> > > IsXLogLogicalInfoEnabled() is done before GetRunningTransactionLocks()
> > > and LogAccessExclusiveLocks()? You said to put it right before
> > > GetRunningTransactionData(), but these functions are done in-between.
> > > It's harmless but it's clearer for me to put them before.
> > Thanks for looking at the patch.
> >
> > I don't see a functional difference in the order here and didn't intend
> > to change the original placement, since IsLogicalDecodingEnabled() was
> > already called at the beginning of LogStandbySnapshot() on HEAD, and
> > none of the calls before inserting the xl_running_xacts record process
> > interrupts (so this backend cannot absorb the barrier and let a
> > concurrent activation complete in-between). The comment was only meant
> > to remind future readers not to defer the check until ProcArrayLock is held.
>
> Thanks for the detailed descriptions. I understood. v3 LGTM.
>
Thank you for updating the patch!
I've reviewed the v3 patch and felt the new comments were a bit long
and redundant to me.
I've attached the v4 patch that rewrote the comments and a commit
message update. The attached nocfbot patch is the diff between v3 and
v4.
Regards,
--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com
| Attachment | Content-Type | Size |
|---|---|---|
| nocfbot_comment_fix_masahiko.patch | text/x-patch | 3.7 KB |
| v4-0001-Fix-LogStandbySnapshot-race-when-enabling-logical.patch | text/x-patch | 7.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Manu | 2026-11-25 20:23:47 | Re: Allow progress tracking of sub-commands |
| Previous Message | Tom Lane | 2026-11-25 19:43:37 | Re: [PATCH] pg_input_is_valid() reuses the first type name inside a PL/pgSQL loop |