Re: Accessing an invalid pointer in BufferManagerRelation structure

Stepan Neretin <slpmcf@gmail.com>

From: Stepan Neretin <slpmcf@gmail.com>
To: Daniil Davydov <3danissimo@gmail.com>
Cc: pgsql-hackers@postgresql.org
Date: 2025-03-26T07:14:40Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Make smgr access for a BufferManagerRelation safer in relcache inval

  2. Doc: use "an SQL" consistently rather than "a SQL"

Hello,

Dmitriy Bondar and I decided to review this patch as part of the CommitFest
Review.

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 also have a question: is the logic correct that if the relation is valid,
we should fetch it rather than the other way around? Additionally, is
checking only the `rd_isvalid` flag sufficient, or should we also consider
the flag below?

```
bool rd_isvalid; /* relcache entry is valid */
```

Other than that, the tests pass, and there are no issues with code style.
Thanks for the patch - it could indeed help prevent future issues.
Best regards,
Stepan Neretin

вт, 11 мар. 2025 г., 17:32 Daniil Davydov <3danissimo@gmail.com>:

> Hi,
> I am posting the new v2 patch, which is now rebased on the `master` branch.
> Waiting for your feedback :)
>
> --
> Best regards,
> Daniil Davydov
>