| From: | Tomas Vondra <tomas(at)vondra(dot)me> |
|---|---|
| To: | Peter Geoghegan <pg(at)bowt(dot)ie>, Andreas Karlsson <andreas(at)proxel(dot)se> |
| Cc: | Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Remove header lock BufferGetLSNAtomic() on architectures with 64 bit atomic operations |
| Date: | 2026-03-10 18:41:54 |
| Message-ID: | 59427c5e-8c15-4c74-8292-efd65787de43@vondra.me |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 2/5/26 16:38, Peter Geoghegan wrote:
> On Wed, Jan 14, 2026 at 1:31 AM Andreas Karlsson <andreas(at)proxel(dot)se> wrote:
>> Yeah, that was a quite big thinko. I have a attached a patch with the
>> thinko fixed but I am still not happy with it. I think I will try to use
>> atomics.h and see if that makes the code nicer to read.
>>
>> Also will after that see what I can do about pageinspect.
>
> I believe that pageinspect's heap_page_items function needs to use
> get_page_from_raw -- see commit 14e9b18fed.
>
> Attached patch 0002-* shows what's required. I'm including your
> original 0001-* patch from your v2 here, to keep CFTester happy.
>
> We (Tomas Vondra and I) are treating this as a dependency for our
> index prefetching patch. It'd be good to get this done soon.
> --
Here's a v4 with some very minor adjustments and updated commit message.
Barring objections, I'm going to push this shortly - in a day or two, to
get it out of the way for the main index prefetch patch.
The only real change is about asserts in BufferGetLSNAtomic( - the new
"ifdef" branch only called PageGetLSN(), so it lost the checks that the
buffer is valid and pinned. Which seems not desirable.
In fact, looking at the existing code, shouldn't the asserts be before
the "fastpath" exit (for cases without hint bits or local buffers)?
The v4 changes both points. It adds the asserts to the new ifdef block,
and moves it up in the existing one.
regards
--
Tomas Vondra
| Attachment | Content-Type | Size |
|---|---|---|
| v4-0001-Do-not-lock-in-BufferGetLSNAtomic-on-archs-with-8.patch | text/x-patch | 8.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shihao zhong | 2026-03-10 18:43:19 | Re: Add missing stats_reset column to pg_stat_database_conflicts view |
| Previous Message | Masahiko Sawada | 2026-03-10 18:39:33 | Re: Miscellaneous message fixes |