Re: Streamify more code paths

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
Cc: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>, Mihail Nikalayeu <mihailnikalayeu(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Streamify more code paths
Date: 2026-08-05 08:00:42
Message-ID: anLtqleSLKNRoAjl@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 04, 2026 at 03:57:47PM +0800, Xuneng Zhou wrote:
> After some discussions/debates with Sol, it offers a copying
> alternative for fixing the issue:
>
> HashMetaPageData local_metapage;
>
> cachedmetap = _hash_getcachedmetap(rel, ...);
> memcpy(&local_metapage, cachedmetap, sizeof(local_metapage));
>
> /* May invalidate and free rd_amcache. */
> some_catalog_access();
>
> use(&local_metapage); /* still allocated */
>
> I don't have a strong opinion over them yet. Just putting it on the
> table in case the game is over before putting my thoughts together.

Sol is an agent, you are free to use it but I tend to take such
automated opinions with a grain of salt, as knowing the internals
avoids a lot of AI noise.

I am not sure that I see the point of a copy if we make the read
initialization happen before we retrieve the cached page so as there
is no interference with invalidation messages, so tweaked a bit the
comment, and applied the fix down to v19.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Damil Shahzad 2026-08-05 08:09:09 Re: Fix var_eq_const: sum selectivity of all matching MCV entries instead of stopping at first match
Previous Message Mihail Nikalayeu 2026-08-05 07:58:14 Re: RI fast path gets cross-type foreign keys wrong