pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Get rid of WALBufMappingLock
2+ messages / 1 participants
[nested] [flat]

* pgsql: Get rid of WALBufMappingLock
@ 2025-02-17 02:25  Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alexander Korotkov @ 2025-02-17 02:25 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Get rid of WALBufMappingLock

Allow multiple backends to initialize WAL buffers concurrently.  This way
`MemSet((char *) NewPage, 0, XLOG_BLCKSZ);` can run in parallel without
taking a single LWLock in exclusive mode.

The new algorithm works as follows:
 * reserve a page for initialization using XLogCtl->InitializeReserved,
 * ensure the page is written out,
 * once the page is initialized, try to advance XLogCtl->InitializedUpTo and
   signal to waiters using XLogCtl->InitializedUpToCondVar condition
   variable,
 * repeat previous steps until we reserve initialization up to the target
   WAL position,
 * wait until concurrent initialization finishes using a
   XLogCtl->InitializedUpToCondVar.

Now, multiple backends can, in parallel, concurrently reserve pages,
initialize them, and advance XLogCtl->InitializedUpTo to point to the latest
initialized page.

Author: Yura Sokolov <y.sokolov@postgrespro.ru>
Co-authored-by: Alexander Korotkov <aekorotkov@gmail.com>
Reviewed-by: Pavel Borisov <pashkin.elfe@gmail.com>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6a2275b8953a4462d44daf001bdd60b3d48f0946

Modified Files
--------------
src/backend/access/transam/xlog.c               | 176 +++++++++++++++++-------
src/backend/utils/activity/wait_event_names.txt |   2 +-
src/include/storage/lwlocklist.h                |   2 +-
3 files changed, 132 insertions(+), 48 deletions(-)



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

* pgsql: Get rid of WALBufMappingLock
@ 2025-04-02 09:45  Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alexander Korotkov @ 2025-04-02 09:45 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Get rid of WALBufMappingLock

Allow multiple backends to initialize WAL buffers concurrently.  This way
`MemSet((char *) NewPage, 0, XLOG_BLCKSZ);` can run in parallel without
taking a single LWLock in exclusive mode.

The new algorithm works as follows:
 * reserve a page for initialization using XLogCtl->InitializeReserved,
 * ensure the page is written out,
 * once the page is initialized, try to advance XLogCtl->InitializedUpTo and
   signal to waiters using XLogCtl->InitializedUpToCondVar condition
   variable,
 * repeat previous steps until we reserve initialization up to the target
   WAL position,
 * wait until concurrent initialization finishes using a
   XLogCtl->InitializedUpToCondVar.

Now, multiple backends can, in parallel, concurrently reserve pages,
initialize them, and advance XLogCtl->InitializedUpTo to point to the latest
initialized page.

Author: Yura Sokolov <y.sokolov@postgrespro.ru>
Co-authored-by: Alexander Korotkov <aekorotkov@gmail.com>
Reviewed-by: Pavel Borisov <pashkin.elfe@gmail.com>
Reviewed-by: Tomas Vondra <tomas@vondra.me>
Tested-by: Michael Paquier <michael@paquier.xyz>

Branch
------
master

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

Modified Files
--------------
src/backend/access/transam/xlog.c               | 234 +++++++++++++++++++-----
src/backend/utils/activity/wait_event_names.txt |   2 +-
src/include/storage/lwlocklist.h                |   2 +-
3 files changed, 189 insertions(+), 49 deletions(-)



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


end of thread, other threads:[~2025-04-02 09:45 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-02-17 02:25 pgsql: Get rid of WALBufMappingLock Alexander Korotkov <akorotkov@postgresql.org>
2025-04-02 09:45 pgsql: Get rid of WALBufMappingLock Alexander Korotkov <akorotkov@postgresql.org>

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