Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit cf9da98

Browse files
committed
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 44ca402 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
1 parent ac219b9 commit cf9da98

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/backend/utils/hash/dynahash.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ init_htab(HTAB *hashp, long nelem)
685685
hctl->nelem_alloc = choose_nelem_alloc(hctl->entrysize);
686686

687687
#if HASH_DEBUG
688-
fprintf(stderr, "init_htab:\n%s%p\n%s%ld\n%s%ld\n%s%d\n%s%ld\n%s%u\n%s%x\n%s%x\n%s%ld\n%s%ld\n",
688+
fprintf(stderr, "init_htab:\n%s%p\n%s%ld\n%s%ld\n%s%d\n%s%ld\n%s%u\n%s%x\n%s%x\n%s%ld\n",
689689
"TABLE POINTER ", hashp,
690690
"DIRECTORY SIZE ", hctl->dsize,
691691
"SEGMENT SIZE ", hctl->ssize,
@@ -694,8 +694,7 @@ init_htab(HTAB *hashp, long nelem)
694694
"MAX BUCKET ", hctl->max_bucket,
695695
"HIGH MASK ", hctl->high_mask,
696696
"LOW MASK ", hctl->low_mask,
697-
"NSEGS ", hctl->nsegs,
698-
"NENTRIES ", hash_get_num_entries(hctl));
697+
"NSEGS ", hctl->nsegs);
699698
#endif
700699
return true;
701700
}

0 commit comments

Comments
 (0)