Fix background writer processing locking in README

Started by Henrik TJ7 months ago2 messageshackers
Jump to latest
#1Henrik TJ
henrik@0x48.dk

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

Attachments:

t139507_1
v1-0001-Update-the-paragraph-on-background-writer-processing.patchtext/plain; CHARSET=US-ASCII; NAME=v1-0001-Update-the-paragraph-on-background-writer-processing.patchDownload+3-6
#2Heikki Linnakangas
hlinnaka@iki.fi
In reply to: Henrik TJ (#1)
Re: Fix background writer processing locking in README

On 28/04/2026 17:25, Henrik TJ wrote:

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.

Committed this with some further copy-editing. The surrounding
paragraphs were pretty outdated too, so I updated them too.

Better late than never :-). Thanks!

- Heikki