pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Replace callers of dynahash.h's my_log() by equivalent in pg_bit
Date: Wed, 10 Sep 2025 02:21:21 +0000
Message-ID: <E1uwASX-001WWQ-2M@gemulon.postgresql.org> (raw)

Replace callers of dynahash.h's my_log() by equivalent in pg_bitutils.h

All the calls replaced by this commit use 4-byte integers for their
variables used in input of my_log2().  Hence, the limit against
too-large inputs does not really apply.  Thresholds are also applied, as
of:
- In nodeAgg.c, the number of partitions is limited by
HASHAGG_MAX_PARTITIONS.
- In nodeHash.c, ExecChooseHashTableSize() caps its maximum number of
buckets based on HashJoinTuple and palloc() allocation limit.
- In worker.c, the number of subxacts tracked by ApplySubXactData uses
uint32, making pg_ceil_log2_64() safe to use directly.

Several approaches have been discussed, like an integration with
thresholds in pg_bitutils.h, but it was found confusing.  This uses
Dean's idea, which gives a simpler result than what I came up with to be
able to remove dynahash.h.  dynahash.h will be removed in a follow-up
commit, removing some duplication with the ceil log2 routines.

Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Discussion: https://postgr.es/m/CAEZATCUJPQD_7sC-wErak2CQGNa6bj2hY-mr8wsBki=kX7f2_A@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/executor/nodeAgg.c           | 3 +--
src/backend/executor/nodeHash.c          | 7 +++----
src/backend/replication/logical/worker.c | 3 +--
3 files changed, 5 insertions(+), 8 deletions(-)



Message-ID: <E1uwASX-001WWQ-2M@gemulon.postgresql.org>
Permalink:  ../E1uwASX-001WWQ-2M@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1uwASX-001WWQ-2M@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: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Replace callers of dynahash.h's my_log() by equivalent in pg_bit
  In-Reply-To: <E1uwASX-001WWQ-2M@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