pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Avoid misbehavior when hash_table_bytes < bucket_size.
4+ messages / 1 participants
[nested] [flat]

* pgsql: Avoid misbehavior when hash_table_bytes < bucket_size.
@ 2022-08-13 21:00  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2022-08-13 21:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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_15_STABLE

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

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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Avoid misbehavior when hash_table_bytes < bucket_size.
@ 2022-08-13 21:00  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2022-08-13 21:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4878ea717c7166e3453cb94796a2044837bf1d2b

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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Avoid misbehavior when hash_table_bytes < bucket_size.
@ 2022-08-13 21:00  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2022-08-13 21:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/55d9cd46f65a5fc0c3bbb69d36cc9dba597a8c9c

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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Avoid misbehavior when hash_table_bytes < bucket_size.
@ 2022-08-13 21:00  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2022-08-13 21:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2022-08-13 21:00 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-08-13 21:00 pgsql: Avoid misbehavior when hash_table_bytes < bucket_size. Tom Lane <tgl@sss.pgh.pa.us>
2022-08-13 21:00 pgsql: Avoid misbehavior when hash_table_bytes < bucket_size. Tom Lane <tgl@sss.pgh.pa.us>
2022-08-13 21:00 pgsql: Avoid misbehavior when hash_table_bytes < bucket_size. Tom Lane <tgl@sss.pgh.pa.us>
2022-08-13 21:00 pgsql: Avoid misbehavior when hash_table_bytes < bucket_size. Tom Lane <tgl@sss.pgh.pa.us>

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