public inbox for [email protected]
help / color / mirror / Atom feedFrom: jie wang <[email protected]>
To: Sami Imseih <[email protected]>
Cc: pgsql-hackers <[email protected]>
Subject: Re: Return DSA area for hash table from GetNamedDSHash()
Date: Tue, 7 Apr 2026 11:59:14 +0800
Message-ID: <CAJnZyeCTvcAQshs8BHSDTAZ6JJgo619sFgWmdKHKf_UawgdeYA@mail.gmail.com> (raw)
In-Reply-To: <CAA5RZ0tKfCVqFnMZtavM42H63ha2Haf_C4mbJNWqkaW30cPW1w@mail.gmail.com>
References: <CAA5RZ0tKfCVqFnMZtavM42H63ha2Haf_C4mbJNWqkaW30cPW1w@mail.gmail.com>
Sami Imseih <[email protected]> 于2026年4月7日周二 06:56写道:
> Hi,
>
> While working on extending tests for dshash.c [1], I realized that a
> user that creates a hash table with GetNamedDSHash() has no way
> to cap the size of the dsa area underpinning the table by using
> dsa_set_size_limit(). This is because the dsa_area created using
> this API is not exposed to the user.
>
> This is a gap for users of the GetNamedDSHash() API,
> because it's very likely that the callers don't want runaway growth of
> these hash tables.
>
> Attached is a new API, dshash_get_dsa_area() that takes in a dshash_table
> and returns the area. The caller can then use dsa_set_size_limit() to limit
> the size.
>
> We could change the GetNamedDSHash() API to take in a size, but that
> will not be ideal since a caller may want to change the size dynamically
> after
> the hash table is created.
>
> I don't have a patch for this yet, but I also think it will make sense for
> pg_dsm_registry_allocations to also show the max_size
>
> postgres=# select * from pg_dsm_registry_allocations;
> name | type | size
> ------------------------+---------+---------
> test_dsm_registry_dsa | area | 1048576
> test_dsm_registry_hash | hash | 1048576
> test_dsm_registry_dsm | segment | 20
> (3 rows)
>
> Thoughts?
>
>
> [1] [https://www.postgresql.org/message-id/acXCJODjsCytdpwT%40paquier.xyz]
>
> --
> Sami Imseih
> Amazon Web Services (AWS)
>
Hi,
I think an assert check could be added in this patch for better safety.
Assert(hash_table != NULL);
Best regards,
--
wang jie
view thread (4+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Return DSA area for hash table from GetNamedDSHash()
In-Reply-To: <CAJnZyeCTvcAQshs8BHSDTAZ6JJgo619sFgWmdKHKf_UawgdeYA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox