agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Wake primary_flush waiters after implicit WAL flushes
2+ messages / 1 participants
[nested] [flat]

* pgsql: Wake primary_flush waiters after implicit WAL flushes
@ 2026-09-12 20:30  Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alexander Korotkov @ 2026-09-12 20:30 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d61f9c90f2ef96b38eceb592b63c688d74cf7611

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(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Wake primary_flush waiters after implicit WAL flushes
@ 2026-09-12 20:30  Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alexander Korotkov @ 2026-09-12 20:30 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-09-12 20:30 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-12 20:30 pgsql: Wake primary_flush waiters after implicit WAL flushes Alexander Korotkov <akorotkov@postgresql.org>
2026-09-12 20:30 pgsql: Wake primary_flush waiters after implicit WAL flushes Alexander Korotkov <akorotkov@postgresql.org>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox