pgsql: Remove broken and useless entry-count printing in HASH_DEBUG cod

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Remove broken and useless entry-count printing in HASH_DEBUG cod
Date: 2017-08-02 16:17:14
Message-ID: E1dcwKg-0001KU-L8@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Remove broken and useless entry-count printing in HASH_DEBUG code.

init_htab(), with #define HASH_DEBUG, prints a bunch of hashtable
parameters. It used to also print nentries, but commit 44ca4022f changed
that to "hash_get_num_entries(hctl)", which is wrong (the parameter should
be "hashp").

Rather than correct the coding, though, let's just remove that field from
the printout. The table must be empty, since we just finished building
it, so expensively calculating the number of entries is rather pointless.
Moreover hash_get_num_entries makes assumptions (about not needing locks)
which we could do without in debugging code.

Noted by Choi Doo-Won in bug #14764. Back-patch to 9.6 where the
faulty code was introduced.

Discussion: https://postgr.es/m/20170802032353.8424.12274@wrigleys.postgresql.org

Branch
------
REL9_6_STABLE

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

Modified Files
--------------
src/backend/utils/hash/dynahash.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2017-08-02 19:07:35 pgsql: Silence warning from modern perl about unescaped braces
Previous Message Peter Eisentraut 2017-08-02 15:36:21 pgsql: Get a snapshot before COPY in table sync