pgsql: Add routines for marking buffers dirty efficiently

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add routines for marking buffers dirty efficiently
Date: 2025-11-27 22:40:11
Message-ID: E1vOkeo-001iyv-2L@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add routines for marking buffers dirty efficiently

This commit introduces new internal bufmgr routines for marking shared
buffers as dirty:
* MarkDirtyUnpinnedBuffer()
* MarkDirtyRelUnpinnedBuffers()
* MarkDirtyAllUnpinnedBuffers()

These functions provide an efficient mechanism to respectively mark one
buffer, all the buffers of a relation, or the entire shared buffer pool
as dirty, something that can be useful to force patterns for the
checkpointer. MarkDirtyUnpinnedBufferInternal(), an extra routine, is
used by these three, to mark as dirty an unpinned buffer.

They are intended as developer tools to manipulate buffer dirtiness in
bulk, and will be used in a follow-up commit.

Author: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
Reviewed-by: Andres Freund <andres(at)anarazel(dot)de>
Reviewed-by: Aidar Imamov <a(dot)imamov(at)postgrespro(dot)ru>
Reviewed-by: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Reviewed-by: Joseph Koshakow <koshy44(at)gmail(dot)com>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Reviewed-by: Yuhang Qiu <iamqyh(at)gmail(dot)com>
Reviewed-by: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAN55FZ0h_YoSqqutxV6DES1RW8ig6wcA8CR9rJk358YRMxZFmw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9660906dbd696146da2c1d8bfdce26b1a2bed1c3

Modified Files
--------------
src/backend/storage/buffer/bufmgr.c | 188 ++++++++++++++++++++++++++++++++++++
src/include/storage/bufmgr.h | 8 ++
2 files changed, 196 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2025-11-27 23:00:46 pgsql: doc: Add missing tags in pg_buffercache page
Previous Message Tom Lane 2025-11-27 18:10:22 pgsql: Allow indexscans on partial hash indexes with implied quals.