pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@postgresql.org
Subject: pgsql: Prevent growth of simplehash tables when they're "too empty".
Date: Mon, 29 Jan 2018 19:26:00 +0000
Message-ID: <E1egF44-0004s2-CC@gemulon.postgresql.org> (raw)

Prevent growth of simplehash tables when they're "too empty".

In cases where simplehash tables where filled with either a lot of
conflicting hash-values, or values that hash to consecutive
values (i.e. build "chains") the growth heuristics in
d4c62a6b623d6eef88218158e9fa3cf974c6c7e5 could trigger rather
explosively.

To fix that, address some of the reasons (see previous commit) of why
the growth heuristics where needed, and only allow growth when the
table isn't too empty. While that means there's a few cases of bad
input that can be slower, that seems a lot better than running very
quickly out of memory.

Author: Tomas Vondra and Andres Freund, with additional input by
    Thomas Munro, Tom Lane Todd A. Cook
Reported-By: Todd A. Cook, Tomas Vondra, Thomas Munro
Discussion: https://postgr.es/m/20171127185700.1470.20362@wrigleys.postgresql.org
Backpatch: 10, where simplehash was introduced

Branch
------
REL_10_STABLE

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

Modified Files
--------------
src/include/lib/simplehash.h | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)



view thread (2+ messages)

Message-ID: <E1egF44-0004s2-CC@gemulon.postgresql.org>
Permalink:  ../E1egF44-0004s2-CC@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1egF44-0004s2-CC@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andres@anarazel.de
  Subject: Re: pgsql: Prevent growth of simplehash tables when they're "too empty".
  In-Reply-To: <E1egF44-0004s2-CC@gemulon.postgresql.org>
  References: <E1egF44-0004s2-CC@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