Add routines for marking buffers dirty efficiently
authorMichael Paquier <michael@paquier.xyz>
Thu, 27 Nov 2025 22:39:33 +0000 (07:39 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 27 Nov 2025 22:39:33 +0000 (07:39 +0900)
commit9660906dbd696146da2c1d8bfdce26b1a2bed1c3
tree7dcfad206281d0b21e8bca4ffb8ee5dd253b4ba8
parent5528e8d1046062698b7db179e4280817eaeb5f30
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@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Aidar Imamov <a.imamov@postgrespro.ru>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Joseph Koshakow <koshy44@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Yuhang Qiu <iamqyh@gmail.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/CAN55FZ0h_YoSqqutxV6DES1RW8ig6wcA8CR9rJk358YRMxZFmw@mail.gmail.com
src/backend/storage/buffer/bufmgr.c
src/include/storage/bufmgr.h