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

From: vignesh C <vignesh21(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Karina Litskevich <litskevichkarina(at)gmail(dot)com>, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, Gurjeet Singh <gurjeet(at)singh(dot)im>, Richard Guo <guofenglinux(at)gmail(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, michael(at)paquier(dot)xyz, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Avoid unncessary always true test (src/backend/storage/buffer/bufmgr.c)
Date: 2024-02-01 18:34:39
Message-ID: CALDaNm3wGbin=tYjDVAJgBkeSU+ZoLH4sgrSAGZvxPHTCa7JHA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 4 Sept 2023 at 21:40, Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> On 30.06.23 20:48, Karina Litskevich wrote:
> > So as for me calling LockRelationForExtension() and
> > UnlockRelationForExtension()
> > without testing eb.rel first looks more like a bug here. However, they
> > are never
> > actually called with eb.rel=NULL because of the EB_* flags, so there is
> > no bug
> > here. I believe we should add Assert checking that when eb.rel is NULL,
> > flags
> > are such that we won't use eb.rel. And yes, we can remove unnecessary checks
> > where the flags value guaranty us that eb.rel is not NULL.
> >
> > And another minor observation. It seems to me that we don't need a
> > "could have
> > been closed while waiting for lock" in ExtendBufferedRelShared(), because I
> > believe the comment above already explains why updating eb.smgr:
> >
> > * Note that another backend might have extended the relation by the time
> > * we get the lock.
> >
> > I attached the new version of the patch as I see it.
>
> This patch version looks the most sensible to me. But as commented
> further downthread, some explanation around the added assertions would
> be good.

The patch which you submitted has been awaiting your attention for
quite some time now. As such, we have moved it to "Returned with
Feedback" and removed it from the reviewing queue. Depending on
timing, this may be reversible. Kindly address the feedback you have
received, and resubmit the patch to the next CommitFest.

Regards,
Vignesh

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2024-02-01 18:44:05 Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?
Previous Message vignesh C 2024-02-01 18:32:59 Re: pgbench - adding pl/pgsql versions of tests