Re: Why we need to check for local buffers in BufferIsExclusiveLocked and BufferIsDirty?

From: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
To: Srinath Reddy Sadipiralla <srinath(dot)reddy(at)zohocorp(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, 3danissimo(at)gmail(dot)com
Subject: Re: Why we need to check for local buffers in BufferIsExclusiveLocked and BufferIsDirty?
Date: 2024-12-06 11:10:51
Message-ID: CAN55FZ03LVQOMgOe-Rd7p1vAf6nV0DO4R_zbN8Mo-Z8Hfi4A5A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Fri, 6 Dec 2024 at 07:03, Srinath Reddy Sadipiralla
<srinath(dot)reddy(at)zohocorp(dot)com> wrote:
>
> > ---- On Thu, 05 Dec 2024 21:11:42 +0530 Andres Freund <andres(at)anarazel(dot)de> wrote ---
>
> > Hi,
>
> > On 2024-12-05 18:38:16 +0530, Srinath Reddy Sadipiralla wrote:
> >> Why we need to check for local buffers in BufferIsExclusiveLocked and
> >> BufferIsDirty?,these 2 functions are called only from
> >> XlogRegisterBuffer,AFAIK which will be called only for permanent
> >> relations.Please correct me if i am wrong.
>
> > That's maybe true for in-core code today, but what guarantees that that's true
> > for the future? And what about code in extensions?
>
> > The gain by not dealing with local buffers in these functions is fairly small
> > too, so there's not really any reason for a change like yours.
>
> > - Andres
>
>
> hmm got it,if thats the case, for local buffers lockbuffer will skip acquiring content lock, so assert will fail in BufferIsDirty.

LGTM.

Adding Daniil to CC as he too started a similar thread [1].

[1] postgr.es/m/CAJDiXggGznOttwREfyZRE4f7oLRz1%3DjTA4xA7u-t6_8CX7j%3D0g%40mail.gmail.com

--
Regards,
Nazir Bilal Yavuz
Microsoft

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2024-12-06 12:13:21 Re: 64 bit numbers vs format strings
Previous Message Andy Fan 2024-12-06 10:50:25 Re: postgres_fdw: Provide better emulation of READ COMMITTED behavior