dshash: Make it possible to suppress out of memory errors

Robert Haas <rhaas@postgresql.org>

Commit: 6f0738ddec85b416e7186e3099be70a3420bf3ea
Author: Robert Haas <rhaas@postgresql.org>
Date: 2026-03-19T15:51:17Z
dshash: Make it possible to suppress out of memory errors

Introduce dshash_find_or_insert_extended, which is just like
dshash_find_or_insert except that it takes a flags argument.
Currently, the only supported flag is DSHASH_INSERT_NO_OOM, but
I have chosen to use an integer rather than a boolean in case we
end up with more flags in the future.

Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Discussion: http://postgr.es/m/CA+TgmoaJwUukUZGu7_yL74oMTQQz2=zqucMhF9+9xBmSC5us1w@mail.gmail.com

Files

PathChange+/−
src/backend/lib/dshash.c modified +69 −25
src/include/lib/dshash.h modified +10 −2

Discussion