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

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



Hi,

On Fri, 6 Dec 2024 at 07:03, Srinath Reddy Sadipiralla
<srinath.reddy@zohocorp.com> wrote:
>
> > ---- On Thu, 05 Dec 2024 21:11:42 +0530 Andres Freund <andres@anarazel.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



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

From
Srinath Reddy Sadipiralla
Date:




> ---- On Fri, 06 Dec 2024 16:40:51 +0530 Nazir Bilal Yavuz <byavuz81@gmail.com> wrote ---

 
> LGTM.

> Regards,
> Nazir Bilal Yavuz
> Microsoft

hi nazir,

sorry i didn't get,what you meant to say is the assert failure which i said is correct and does my patch to this looks good?🤔

Regards,
Srinath Reddy Sadipiralla
Member of Technical Staff
Zoho






Hi Srinath,

On Sat, 7 Dec 2024 at 11:17, Srinath Reddy Sadipiralla
<srinath.reddy@zohocorp.com> wrote:
> > ---- On Fri, 06 Dec 2024 16:40:51 +0530 Nazir Bilal Yavuz <byavuz81@gmail.com> wrote ---
> > LGTM.
>
> sorry i didn't get,what you meant to say is the assert failure which i said is correct and does my patch to this
looksgood?🤔 

Sorry if I was not clear. Yes, I wanted to say what you said is
correct and the patch looks good to me.

--
Regards,
Nazir Bilal Yavuz
Microsoft



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

From
Srinath Reddy Sadipiralla
Date:
Hi,

added this bug to commitfest https://commitfest.postgresql.org/51/5428/ 

Regards,
Srinath Reddy Sadipiralla
Member of Technical Staff
Zoho



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

From
Srinath Reddy Sadipiralla
Date:




---- On Sun, 08 Dec 2024 18:23:21 +0530 Nazir Bilal Yavuz <byavuz81@gmail.com> wrote ---

Hi Srinath,

On Sat, 7 Dec 2024 at 11:17, Srinath Reddy Sadipiralla
<srinath.reddy@zohocorp.com> wrote:
> > ---- On Fri, 06 Dec 2024 16:40:51 +0530 Nazir Bilal Yavuz <byavuz81@gmail.com> wrote ---
> > LGTM.
>
> sorry i didn't get,what you meant to say is the assert failure which i said is correct and does my patch to this looks good?🤔

Sorry if I was not clear. Yes, I wanted to say what you said is
correct and the patch looks good to me.

--
Regards,
Nazir Bilal Yavuz
Microsoft








============ Forwarded message ============
From: Srinath Reddy Sadipiralla <srinath.reddy@zohocorp.com>
To: "Nazir Bilal Yavuz"<byavuz81@gmail.com>, "pgsql-hackers"<pgsql-hackers@lists.postgresql.org>, "Andres Freund"<andres@anarazel.de>
Date: Mon, 09 Dec 2024 10:14:06 +0530
Subject: Re: Why we need to check for local buffers in BufferIsExclusiveLocked and BufferIsDirty?
============ Forwarded message ============

Hi,

added this bug to commitfest https://commitfest.postgresql.org/51/5428/ 

Regards,
Srinath Reddy Sadipiralla
Member of Technical Staff
Zoho