pgsql: simplehash: preserve consistency in case of OOM.

From: Jeff Davis <jdavis(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: simplehash: preserve consistency in case of OOM.
Date: 2023-11-17 22:22:47
Message-ID: E1r47Ed-005wqO-B2@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

simplehash: preserve consistency in case of OOM.

Compute size first, then allocate, then update the structure.

Previously, an out-of-memory when growing could leave the hashtable in
an inconsistent state.

Discussion: https://postgr.es/m/20231117201334.eyb542qr5yk4gilq@awork3.anarazel.de
Reviewed-by: Andres Freund
Reviewed-by: Gurjeet Singh

Branch
------
master

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

Modified Files
--------------
src/include/lib/simplehash.h | 42 +++++++++++++++++++++++++++++++-----------
1 file changed, 31 insertions(+), 11 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2023-11-18 02:55:26 pgsql: meson: Fix missing dependency from install-quiet to sepgsql.sql
Previous Message Andres Freund 2023-11-17 21:56:23 Re: pgsql: docs: Document --with-selinux/-Dselinux options centrally