Get rid of radix tree's general purpose memory context
authorJohn Naylor <john.naylor@postgresql.org>
Fri, 20 Dec 2024 06:04:18 +0000 (13:04 +0700)
committerJohn Naylor <john.naylor@postgresql.org>
Mon, 6 Jan 2025 04:21:21 +0000 (11:21 +0700)
commite8a6f1f908d03b836c8b5379b449346ad32c1ba1
tree56157ad37ff6fc3c4598ecc263040208473cdeec
parent960013f2a1f9e51aad85c91aceeb442508be6032
Get rid of radix tree's general purpose memory context

Previously, this was notionally used only for the entry point of the
tree and as a convenient parent for other contexts.

For shared memory, the creator previously allocated the entry point
in this context, but attaching backends didn't have access to that,
so they just used the caller's context. For the sake of consistency,
allocate every instance of an entry point in the caller's context.

For local memory, allocate the control object in the caller's context
as well. This commit also makes the "leaf context" the notional parent
of the child contexts used for nodes, so it's a bit of a misnomer,
but a future commit will make the node contexts independent rather
than children, so leave it this way for now to avoid code churn.

The memory context parameter for RT_CREATE is now unused in the case
of shared memory, so remove it and adjust callers to match.

In passing, remove unused "context" member from struct TidStore,
which seems to have been an oversight.

Reviewed by Masahiko Sawada

Discussion: https://postgr.es/m/CANWCAZZDCo4k5oURg_pPxM6+WZ1oiG=sqgjmQiELuyP0Vtrwig@mail.gmail.com
src/backend/access/common/tidstore.c
src/include/lib/radixtree.h
src/test/modules/test_radixtree/test_radixtree.c