Re: Fix crash when non-creator being an iteration on shared radix tree

From: John Naylor <johncnaylorls(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix crash when non-creator being an iteration on shared radix tree
Date: 2024-12-21 05:55:42
Message-ID: CANWCAZZy9z-JA6qAgVPdcCHAJ6dYNe22z3wW-mgnRhvhhAqk_w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Dec 21, 2024 at 2:17 AM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>
> On Fri, Dec 20, 2024 at 2:27 AM John Naylor <johncnaylorls(at)gmail(dot)com> wrote:

> > v3-0001 allocates the iter data in the caller's context. It's a small
> > patch, but still a core behavior change so proposed for master-only. I
> > believe your v1 is still the least invasive fix for PG17.
>
> I agree to use v1 for v17.

Okay, did you want to commit that separately, or together with my 0001
on master? Either way, I've put a bit more effort into the commit
message in v4 and adjusted the comment slightly.

> > It's trivial after 0001-02: 0003 removes makes one test use slab as
> > the passed context (only 32-bit systems would actually use it
> > currently).
>
> These changes make sense to me. Here are a few comments:
>
> RT_RADIX_TREE has 'leaf_context' but it seems that we use it only for
> local memory. Do we want to declare only in the !RT_SHMEM case?

That's already the case, if I understand your statement correctly.

> ---
> /*
> * Similar to TidStoreCreateLocal() but create a shared TidStore on a
> * DSA area. The TID storage will live in the DSA area, and the memory
> * context rt_context will have only meta data of the radix tree.
> *
> * The returned object is allocated in backend-local memory.
> */
>
> We need to update the comment about rt_context too since we no longer
> use rt_context for shared tidstore.

Fixed. BTW, it seems TidStore.context is unused?

--
John Naylor
Amazon Web Services

Attachment Content-Type Size
v4-0003-Always-use-the-caller-provided-context-for-radix-.patch text/x-patch 2.8 KB
v4-0001-Get-rid-of-radix-tree-s-separate-iterator-context.patch text/x-patch 2.2 KB
v4-0002-Get-rid-of-radix-tree-s-general-purpose-memory-co.patch text/x-patch 9.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2024-12-21 05:57:04 Re: Add XMLNamespaces to XMLElement
Previous Message Vik Fearing 2024-12-21 05:22:39 Re: Discussion on a LISTEN-ALL syntax