Re: Lost walsender wakeup stalls synchronous commits until the standby's next reply (16+)

From: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
To: Rajesh Kumar Thandapani <rajeshkumarth(at)google(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Alex Speller <alex(at)alexspeller(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Lost walsender wakeup stalls synchronous commits until the standby's next reply (16+)
Date: 2026-11-26 07:51:31
Message-ID: CABPTF7VpAXFkiCp3Fjh2uWMY4JMjK_HS_6o1iO0sxprvnSagDg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Rajesh,

On Thu, Nov 26, 2026 at 12:21 PM Rajesh Kumar Thandapani
<rajeshkumarth(at)google(dot)com> wrote:
>
> On Wed, Nov 25, 2026 at 4:47 PM Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> > Thanks for reporting this issue!
> >
> > Yeah, Codex also identified it when I used it to review the patch for
> > logical replication. I was thinking to look into it after fixing the logical
> > replication issue. Now that I've pushed that fix, I'll work on this one next.
>
> Hi Fujii-san,
>
> I had been looking into this standby confirmation wakeup race too, so I
> rebased my patch on top of bc85373ff13 in case it saves you some time.
>
> The attached patch passes RecentFlushPtr (rather than loc) as target_lsn
> to WalSndWait() when wait_event is WAIT_EVENT_WAIT_FOR_STANDBY_CONFIRMATION,
> matching what NeedToWaitForStandbys() tests, and rechecks
> StandbySlotsHaveCaughtup(target_lsn, LOG_NEVER) after joining
> wal_confirm_rcv_cv. Passing LOG_NEVER avoids duplicating any warnings
> already emitted by NeedToWaitForStandbys().
>
> I also attached a backbranch variant for v17 and v18 that passes 0 as
> elevel since LOG_NEVER was added in v19. Verified against Xuneng's
> reproducer (the walsender now delivers the commit immediately instead of
> stalling in WaitForStandbyConfirmation), confirmed no duplicate inactive-slot
> warnings are logged, and ran 040_standby_failover_slots_sync.pl and
> test_decoding cleanly.

Thanks for the patches. Both LGTM.

--
Regards,
Xuneng Zhou
HighGo Software Co., Ltd.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Daniel Pedersen 2026-11-26 08:11:20 Re: BUG #19939: In a read-only transaction, a plain SELECT ... INTO is refused, but the same statement under EXPLAIN
Previous Message Raja Sai pranav 2026-11-26 07:15:11 Re: BUG #19890: pg_receivewal advances past a truncated LZ4 WAL segment