Re: Shutdown indefinitely stuck due to unflushed FPI_FOR_HINT record

Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>

From: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
To: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2026-02-26T10:35:57Z
Lists: pgsql-hackers

Attachments

And here's a script reproducing the issue. It creates the clusters,
sets up the logical replication and runs the necessary query to leave
FPI_FOR_HINT as the last written record.

If successful, the script should have pg_stop stuck with 'waiting for
server to shut down.......', with the walsender stuck at 100% CPU.

Commits

  1. Fix WAL flush LSN used by logical walsender during shutdown

  2. Use GetXLogInsertEndRecPtr in gistGetFakeLSN

  3. Fix publisher shutdown hang caused by logical walsender busy loop.