Re: Compilation issues for HASH_STATISTICS and HASH_DEBUG options
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>,
"Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>,
"pgsql-hackers@lists.postgresql.org"
<pgsql-hackers@lists.postgresql.org>
Date: 2025-08-15T15:16:46Z
Lists: pgsql-hackers
David Rowley <dgrowleyml@gmail.com> writes: > Yeah. Just to aid discussion, let's say the attached patch. I think if we want to claim that these bits represent actually usable functionality, we need to do more than s/fprintf/elog/. Some points: * Neither printout identifies which hashtable it's talking about in any usable fashion, which is silly when we could print hashp->tabname. HASH_DEBUG prints the pointer to the table, which is certainly useless unless you've got gdb attached to the session, and probably useless even then without the tabname. * The output formats are randomly inconsistent with each other, and don't look much like other outputs either. I'm particularly vexed by the fact that you could not usefully grep the log for this data. I think we should switch them to a single log line so that grepping for a hashtable name could produce something useful. * As it stands, HASH_DEBUG prints only at hashtable creation and HASH_STATISTICS prints only at table destruction. Is that really enough? I'm thinking in particular of shared and session-lifespan hashtables, which won't ever receive a hash_destroy call. * One fairly believable use-case for hash_stats() is to be called manually from a debugger. To make that a little easier, I think we should fix it to not crash if "where" is NULL. > I don't really have an idea on which debug level these should appear > on, however. I picked DEBUG4 for no other reason than DEBUG5 being > quite verbose with AIO related messages. No opinion here either. regards, tom lane
Commits
-
Remove HASH_DEBUG output from dynahash.c
- a98ccf727ebb 19 (unreleased) landed
-
Use elog(DEBUG4) for dynahash.c statistics output
- 05fcb9667c37 19 (unreleased) landed
-
Fix invalid format string in HASH_DEBUG code
- 2c7c08a090f2 14.20 landed
- 199a347d29e5 15.15 landed
- d809494cdfc5 16.11 landed
- 04b384b3efb2 17.7 landed
- 1571c7ca5dc9 18.0 landed
- 296cba276081 19 (unreleased) landed
-
Fix failing -D HASH_STATISTICS builds
- efe705b05cc1 17.7 landed
- e4ba326295c5 18.0 landed
- ca38912512a9 19 (unreleased) landed
-
Refactor initial hash lookup in dynahash.c
- cc5ef90edd80 17.0 cited
-
Remove large fill factor support from dynahash.c.
- be0a6666656e 14.0 cited
-
Remove broken and useless entry-count printing in HASH_DEBUG code.
- 9d4e56699957 10.0 cited
-
Partition the freelist for shared dynahash tables.
- 44ca4022f3f9 9.6.0 cited