pgsql: Get rid of radix tree's general purpose memory context - Mailing list pgsql-committers

From John Naylor
Subject pgsql: Get rid of radix tree's general purpose memory context
Date
Msg-id E1tUf0C-0005eS-UA@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e8a6f1f908d03b836c8b5379b449346ad32c1ba1

Modified Files
--------------
src/backend/access/common/tidstore.c             | 26 +++++---------
src/include/lib/radixtree.h                      | 35 ++++++++----------
src/test/modules/test_radixtree/test_radixtree.c | 45 ++++++++++--------------
3 files changed, 41 insertions(+), 65 deletions(-)


pgsql-committers by date:

Previous
From: John Naylor
Date:
Subject: pgsql: Use caller's memory context for radix tree iteration state
Next
From: John Naylor
Date:
Subject: pgsql: Always use the caller-provided context for radix tree leaves