public inbox for [email protected]
help / color / mirror / Atom feedFrom: Sami Imseih <[email protected]>
To: Michael Paquier <[email protected]>
To: [email protected]
Cc: pgsql-hackers <[email protected]>
Subject: Re: Return DSA area for hash table from GetNamedDSHash()
Date: Thu, 9 Apr 2026 16:11:48 -0500
Message-ID: <CAA5RZ0se3N-uQHi1L_32C1HM-ZW4T_D3vw5eCf0vDO2tHwB=sg@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAA5RZ0tKfCVqFnMZtavM42H63ha2Haf_C4mbJNWqkaW30cPW1w@mail.gmail.com>
<[email protected]>
Thanks for the replies!
> I think an assert check could be added in this patch for better safety.
> Assert(hash_table != NULL);
>
I followed the same approach we take for dshash_destroy() and
dshash_get_hash_table_handle(). The caller is responsible for
not passing in a NULL hash table, else that assert will segfault.
> +dsa_area *
> +dshash_get_dsa_area(dshash_table *hash_table)
> +{
> + Assert(hash_table->control->magic == DSHASH_MAGIC);
> +
> + return hash_table->area;
>
> Rather than an API that returns the DSA area, perhaps it would be more
> natural to have a wrapper that calls dsa_set_size_limit(), using an
> existing dshash_table in input?
hm, having GetNamedDSA return dsa_area for direct use while requiring
a special wrapper for the dshash case creates an inconsistent API in
dsm_registry.h. dshash_get_dsa_area() means either way the dsa_area is
obtained, dsa_set_size_limit() can be used to set the size.
--
Sami
view thread (4+ messages)
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], [email protected]
Subject: Re: Return DSA area for hash table from GetNamedDSHash()
In-Reply-To: <CAA5RZ0se3N-uQHi1L_32C1HM-ZW4T_D3vw5eCf0vDO2tHwB=sg@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