Re: Accessing an invalid pointer in BufferManagerRelation structure - Mailing list pgsql-hackers

From Álvaro Herrera
Subject Re: Accessing an invalid pointer in BufferManagerRelation structure
Date
Msg-id 202510191108.vl5bgq4j5usd@alvherre.pgsql
Whole thread Raw
In response to Re: Accessing an invalid pointer in BufferManagerRelation structure  (Daniil Davydov <3danissimo@gmail.com>)
List pgsql-hackers
On 2025-Apr-14, Daniil Davydov wrote:

> On Wed, Mar 26, 2025 at 2:14 PM Stepan Neretin <slpmcf@gmail.com> wrote:

> > The first thing we both noticed is that the macro calls a function
> > that won't be available without an additional header. This seems a
> > bit inconvenient.

I think this is a fact of life.  We don't have an automated check for
such patterns anymore, so the users of the macro will have to include
the other file.  In any case I would rather they include utils/rel.h
themselves, than forcing rel.h into every single file that includes
bufmgr.h.

> Well, I rebased the patch onto the latest `master`
> (b51f86e49a7f119004c0ce5d0be89cdf98309141) and noticed that we don't
> need to include `rel.h` in `localbuf.c` directly anymore, because
> `#include lmgr.h` was added in memutils.h
> I guess it solves this issue. Please, see v3 patch.

Not anymore.

I edited your comments a bit.  What do you think of this version?

I don't think this is backpatchable material, mainly because you said
you don't see any situations in which relcache invalidations would
occur in the middle of this.  Can you can cause a problem to occur by
adding an untimely invalidation somewhere without this patch, which is
fixed by this patch?


BTW how does this interact with SMgrRelation pinning?

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"Industry suffers from the managerial dogma that for the sake of stability
and continuity, the company should be independent of the competence of
individual employees."                                      (E. Dijkstra)

Attachment

pgsql-hackers by date:

Previous
From: Álvaro Herrera
Date:
Subject: Re: FSM doesn't recover after zeroing damaged page.
Next
From: Rintaro Ikeda
Date:
Subject: Re: Suggestion to add --continue-client-on-abort option to pgbench