From: | Alexander Korotkov <akorotkov(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Get rid of WALBufMappingLock |
Date: | 2025-02-17 02:25:35 |
Message-ID: | E1tjqpD-007X6y-9q@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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(dot)sokolov(at)postgrespro(dot)ru>
Co-authored-by: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Reviewed-by: Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)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(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2025-02-17 04:16:25 | pgsql: Move wal_buffers_full from PgStat_PendingWalStats to WalUsage |
Previous Message | Richard Guo | 2025-02-17 02:13:52 | pgsql: Adjust tuples estimate for appendrels |