Re: Shutdown indefinitely stuck due to unflushed FPI_FOR_HINT record - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: Shutdown indefinitely stuck due to unflushed FPI_FOR_HINT record
Date
Msg-id CAHGQGwHFKF+x4E+SqedMCnmLCitxjTUUtSyL_+mMeuq-GbEt6w@mail.gmail.com
Whole thread
In response to Re: Shutdown indefinitely stuck due to unflushed FPI_FOR_HINT record  (Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>)
Responses Re: Shutdown indefinitely stuck due to unflushed FPI_FOR_HINT record
List pgsql-hackers
> Shutdown may be indefinitely stuck under the following circumstances:

Thanks for reporting this issue and for the patch!

I was able to reproduce the problem on master.


On Tue, Feb 24, 2026 at 6:47 PM Anthonin Bonnefoy
<anthonin.bonnefoy@datadoghq.com> wrote:
> So, it looks like the root issue is more that the async LSN isn't
> updated when a transaction without xid is rollbacked.
> When going through CommitTransaction, such a transaction would still
> go through XLogSetAsyncXactLSN.
>
> I've updated the patch with this new approach: XLogSetAsyncXactLSN is
> now called in RecordTransactionAbort even when a xid wasn't assigned.
> With this, the logical walsender is able to force the flush of the
> last partial page using XLogBackgroundFlush.

I'm a bit concerned that this approach could cause walwriter to attempt
WAL writes more aggressively in some cases, adding overhead during
normal processing. If the goal is only to prevent shutdown from getting stuck,
instead, would it be sufficient for ShutdownXLOG() to call
XLogSetAsyncXactLSN() just before WalSndWaitStopping()?

Regards,

--
Fujii Masao



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: pgstat include expansion
Next
From: Yura Sokolov
Date:
Subject: Re: Fix bug in multixact Oldest*MXactId initialization and access