agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Alexander Korotkov <akorotkov@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Wake primary_flush waiters after implicit WAL flushes
Date: Sat, 12 Sep 2026 20:30:50 +0000
Message-ID: <E1x5UN8-000000003ra-0afE@gemulon.postgresql.org> (raw)
Wake primary_flush waiters after implicit WAL flushes
XLogWrite() can advance the flush position when it finishes a WAL
segment, even if its caller requested only a write. When this happens
while AdvanceXLInsertBuffer() recycles a buffer, primary_flush waiters
are not notified and can sleep until an unrelated flush or checkpoint.
Track such progress with a process-local pending flag and perform the
wakeup after releasing WAL write and insertion locks, keeping
WaitLSNLock acquisition outside the contended WAL path. Add a
deterministic injection-point test that forces this path and inspects
the registration directly in shared memory.
Author: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/CABPTF7U0gW5%2B-4oL7-qdML-yerZxUb7ku4QXp7JxCYo0qyJ_Tw%40mail.gmail.com
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Backpatch-through: 19
Branch
------
REL_19_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/854be98cc4aad48a960197e4d70b1da9063a906e
Modified Files
--------------
src/backend/access/transam/xlog.c | 34 ++++++++
src/backend/access/transam/xlogwait.c | 3 +
src/backend/postmaster/walwriter.c | 3 +
src/test/recovery/t/049_wait_for_lsn.pl | 146 ++++++++++++++++++++++++++++++++
4 files changed, 186 insertions(+)
view thread (2+ messages)
Message-ID: <E1x5UN8-000000003ra-0afE@gemulon.postgresql.org>
Permalink: ../E1x5UN8-000000003ra-0afE@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1x5UN8-000000003ra-0afE@gemulon.postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: akorotkov@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Wake primary_flush waiters after implicit WAL flushes
In-Reply-To: <E1x5UN8-000000003ra-0afE@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox