pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Davis <jdavis@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: simplehash: preserve consistency in case of OOM.
Date: Fri, 17 Nov 2023 22:22:47 +0000
Message-ID: <E1r47Ed-005wqO-B2@gemulon.postgresql.org> (raw)

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(-)



Message-ID: <E1r47Ed-005wqO-B2@gemulon.postgresql.org>
Permalink:  ../E1r47Ed-005wqO-B2@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1r47Ed-005wqO-B2@gemulon.postgresql.org

 · 

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: pgsql-committers@postgresql.org
  Cc: jdavis@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: simplehash: preserve consistency in case of OOM.
  In-Reply-To: <E1r47Ed-005wqO-B2@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox