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

From: Mihail Nikalayeu <mihailnikalayeu(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org, Melanie Plageman <melanieplageman(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Noah Misch <noah(at)leadboat(dot)com>
Subject: Re: Buffer locking is special (hints, checksums, AIO writes)
Date: 2025-08-23 10:31:53
Message-ID: CADzfLwV65qEO1z02Spse47pNP-vGLhaBZpDXfftb2w-28UMf5A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello, Andres!

Andres Freund <andres(at)anarazel(dot)de>:
>
> As part of that introduce a new lock level in-between share and exclusive
> locks (provisionally called share-exclusive, but I hate it). The new lock
> level allows other share lockers, but can only be held by one backend.
>
> This allows to change the rules so that:
>
> 1) Share lockers are not allowed to modify buffers anymore
> 2) Hint bits need the new lock mode (conditionally upgrading the lock in SetHintBits())
> 3) Write IO needs to the new lock level

IIUC, it may be mapped to existing locking system:

BUFFER_LOCK_SHARE ----> AccessShareLock
new lock mode ----> ExclusiveLock
BUFFER_LOCK_EXCLUSIVE ----> AccessExclusiveLock

So, it all may be named:

BUFFER_LOCK_ACCESS_SHARE
BUFFER_LOCK_EXCLUSIVE
BUFFER_LOCK_ACCESS_EXCLUSIVE

being more consistent with table-level locking system.

Greetings,
Mikhail.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2025-08-23 11:05:55 Re: Potential problem in commit f777d773878 and 4f7f7b03758
Previous Message Dave Cramer 2025-08-23 10:20:26 Re: Transparent column encryption