pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid misbehavior when hash_table_bytes < bucket_size.
Date: Sat, 13 Aug 2022 21:00:46 +0000
Message-ID: <E1oMyFR-000dxx-DB@gemulon.postgresql.org> (raw)

Avoid misbehavior when hash_table_bytes < bucket_size.

It's possible to reach this case when work_mem is very small and tupsize
is (relatively) very large.  In that case ExecChooseHashTableSize would
get an assertion failure, or with asserts off it'd compute nbuckets = 0,
which'd likely cause misbehavior later (I've not checked).  To fix,
clamp the number of buckets to be at least 1.

This is due to faulty conversion of old my_log2() coding in 28d936031.
Back-patch to v13, as that was.

Zhang Mingli

Discussion: https://postgr.es/m/beb64ca0-91e2-44ac-bf4a-7ea36275ec02@Spark

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1dfc9193af7ff3cde963aa153e21fadbfebe030a

Modified Files
--------------
src/backend/executor/nodeHash.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)



view thread (4+ messages)

Message-ID: <E1oMyFR-000dxx-DB@gemulon.postgresql.org>
Permalink:  ../E1oMyFR-000dxx-DB@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1oMyFR-000dxx-DB@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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Avoid misbehavior when hash_table_bytes < bucket_size.
  In-Reply-To: <E1oMyFR-000dxx-DB@gemulon.postgresql.org>
  References: <E1oMyFR-000dxx-DB@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