pgsql: Avoid misbehavior when hash_table_bytes < bucket_size.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Avoid misbehavior when hash_table_bytes < bucket_size.
Date: 2022-08-13 21:00:46
Message-ID: E1oMyFR-000dxx-DB@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2022-08-13 21:06:32 pgsql: Remove configure probe for struct sockaddr_storage.
Previous Message Thomas Munro 2022-08-13 20:51:38 pgsql: Remove HAVE_UNIX_SOCKETS.