Re: dshash_find_or_insert vs. OOM

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Sami Imseih <samimseih@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, Robert Haas <robertmhaas@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Thomas Munro <thomas.munro@gmail.com>
Date: 2026-04-08T01:04:50Z
Lists: pgsql-hackers
On Tue, Apr 07, 2026 at 12:00:14PM -0500, Sami Imseih wrote:
> My apologies for the late response here. I spent some time looking at
> this yesterday and came to the conclusion that we can add dshash tests
> to test_dsm_registry, which already allocates a dshash via
> GetNamedDSHash(). However, I also realized that the API has a gap: callers
> cannot set a size limit on the dshash. I need this for the test, but
> more importantly it's a limitation of the API itself.

As in dsa_set_size_limit() cannot be set for a dshash currently.
Indeed that could be independently useful for some use cases.

> So I plan to
> target v20 for the tests, as it's likely too late for v19. To start, I've
> submitted a patch for allowing callers to set a size limit on a
> GetNamedDSHash()-allocated dshash [1].
> 
> [1] https://commitfest.postgresql.org/patch/6655/

That's too late for v19, at least here.  Thanks for pursuing this
work.
--
Michael

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. dshash: Make it possible to suppress out of memory errors