Use elog(DEBUG4) for dynahash.c statistics output
authorDavid Rowley <drowley@postgresql.org>
Mon, 18 Aug 2025 22:57:44 +0000 (10:57 +1200)
committerDavid Rowley <drowley@postgresql.org>
Mon, 18 Aug 2025 22:57:44 +0000 (10:57 +1200)
commit05fcb9667c371fda93830b87269c01d74ca247e5
tree3f9afe638a0e4e161cb24e51b1d70b1fbe3e0a6f
parent5e8f05cd70a6a5446801b4c733874bd6603eba7b
Use elog(DEBUG4) for dynahash.c statistics output

Previously this was being output to stderr.  This commit adjusts things
to use elog(DEBUG4).  Here we also adjust the format of the message to
add the hash table name and also put the message on a single line.  This
should make grepping the logs for this information easier.

Also get rid of the global hash table statistics.  This seems very dated
and didn't fit very well with trying to put all the statistics for a
specific hash table on a single log line.

The main aim here is to allow it so we can have at least one buildfarm
member build with HASH_STATISTICS to help prevent future changes from
breaking things in that area.  ca3891251 recently fixed some issues
here.

In passing, switch to using uint64 data types rather than longs for the
usage counters.  The long type is 32 bits on some platforms we support.

Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAApHDvoccvJ9CG5zx+i-EyCzJbcL5K=CzqrnL_YN59qaL5hiaw@mail.gmail.com
src/backend/utils/hash/dynahash.c
src/include/utils/hsearch.h