Hi
I was reading through src/backend/storage/buffer/README, and the paragraph
about writing out buffers seems not to have been updated after starting to
use the share-exclusive lock level, commit 82467f627bd4.
The paragraph in question:
The background writer takes shared content lock on a buffer while writing it
out (and anyone else who flushes buffer contents to disk must do so too).
This ensures that the page image transferred to disk is reasonably consistent.
We might miss a hint-bit update or two but that isn't a problem, for the same
reasons mentioned under buffer access rules.
The attached patch updates this to use shared-exclusive, and removes the
consistency bit. Arguably the entire paragraph could be removed, as the
issue is covered earlier in the document, but I tried to keep the doc
mostly as-is.
best regards, Henrik
From 241ba4e3ecda6421196addff37704e84a33d5e62 Mon Sep 17 00:00:00 2001
From: Henrik TJ <[email protected]>
Date: Tue, 28 Apr 2026 12:40:18 +0200
Subject: [PATCH] Update the paragraph on background writer processing on
locking to say share-exlusive, as that should now be used for writing, and
remove the note on consistency, as it is no longer relevant.
Probably a tiny oversight in 82467f627bd4
---
src/backend/storage/buffer/README | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/backend/storage/buffer/README
b/src/backend/storage/buffer/README
index b332e002ba1..809aaf8d28b 100644
--- a/src/backend/storage/buffer/README
+++ b/src/backend/storage/buffer/README
@@ -265,11 +265,9 @@ only needs to take the lock long enough to read the
variable value, not
while scanning the buffers. (This is a very substantial improvement in
the contention cost of the writer compared to PG 8.0.)
-The background writer takes shared content lock on a buffer while writing it
-out (and anyone else who flushes buffer contents to disk must do so too).
-This ensures that the page image transferred to disk is reasonably consistent.
-We might miss a hint-bit update or two but that isn't a problem, for the same
-reasons mentioned under buffer access rules.
+The background writer takes shared-exclusive content lock on a buffer while
+writing it out (and anyone else who flushes buffer contents to disk must do
+so too). This ensures that the page image transferred to disk is consistent.
As of 8.4, background writer starts during recovery mode when there is
some form of potentially extended recovery to perform. It performs an
--
2.53.0