Re: Buffer locking is special (hints, checksums, AIO writes)

From: cca5507 <cca5507(at)qq(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Buffer locking is special (hints, checksums, AIO writes)
Date: 2026-04-03 10:06:46
Message-ID: tencent_CFA13385DEB545296F328E7897074D76DC08@qq.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I find some outdated comments in src/backend/storage/buffer/README:

```
Note that a buffer header's spinlock does not control access to the data
held within the buffer. Each buffer header also contains an LWLock, the
"buffer content lock", that *does* represent the right to access the data
in the buffer. It is used per the rules above.
```

"Each buffer header also contains an LWLock" is outdated.

```
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 content lock ...", should be "share-exclusive content lock".

"We might miss a hint-bit update or two ...", maybe already fixed by share-exclusive content lock?

--
Regards,
ChangAo Chen

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Florents Tselai 2026-04-03 09:56:02 Re: Patch: Add tsmatch JSONPath operator for granular Full Text Search