Re: Avoid unncessary always true test (src/backend/storage/buffer/bufmgr.c)

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, michael(at)paquier(dot)xyz, gurjeet(at)singh(dot)im, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Avoid unncessary always true test (src/backend/storage/buffer/bufmgr.c)
Date: 2023-06-14 12:11:51
Message-ID: CAEudQAr7araiFMW5CN3U3nb72DmoQxQ8-VYh2x0W_3EwKBbefg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em qua., 14 de jun. de 2023 às 06:51, Richard Guo <guofenglinux(at)gmail(dot)com>
escreveu:

>
> On Tue, Jun 13, 2023 at 3:39 PM Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
> wrote:
>
>> Gurjeet has mentioned that eb.rel cannot be modified by another
>> process since the value or memory is in the local stack, and I believe
>> he's correct.
>>
>> If the pointed Relation had been blown out, eb.rel would be left
>> dangling, not nullified. However, I don't believe this situation
>> happens (or it shouldn't happen) as the entire relation should already
>> be locked.
>
>
> Yeah, Gurjeet is right. I had a thinko here. eb.rel should not be NULL
> pointer in any case. And as we've acquired the lock for it, it should
> not have been closed. So I think we can remove the check for eb.rel in
> the two places.
>
Ok,
As there is a consensus on removing the tests and the comment is still
relevant,
here is a new version for analysis.

regards,
Ranier Vilela

Attachment Content-Type Size
v3-0001-Remove-always-true-checks.patch application/octet-stream 968 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Niyas Sait 2023-06-14 12:25:17 Re: [PATCH] Add native windows on arm64 support
Previous Message Aleksander Alekseev 2023-06-14 11:08:03 Re: [PATCH] Slight improvement of worker_spi.c example