pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Antonin Houska <ah@cybertec.at>
To: pgsql-hackers@postgresql.org
Subject: Comment fix and question about dshash.c
Date: Fri, 26 Oct 2018 13:32:01 +0200
Message-ID: <8726.1540553521@localhost> (raw)

1. The return type of resize() function is void, so I propose part of the
header comment to be removed:

inline patch 1: src/backend/lib/dshash.c (+1/-3 lines) download inline-1.patchdiff --git a/src/backend/lib/dshash.c b/src/backend/lib/dshash.c index b46f7c4cfd..b2b8fe60e1 100644 --- a/src/backend/lib/dshash.c +++ b/src/backend/lib/dshash.c @@ -672,9 +672,7 @@ delete_item(dshash_table *hash_table, dshash_table_item *item) /* * Grow the hash table if necessary to the requested number of buckets. The - * requested size must be double some previously observed size. Returns true - * if the table was successfully expanded or found to be big enough already - * (because another backend expanded it). + * requested size must be double some previously observed size. * * Must be called without any partition lock held. */
2. Can anyone please explain this macro? /* Max entries before we need to grow. Half + quarter = 75% load factor. */ #define MAX_COUNT_PER_PARTITION(hash_table) \ (BUCKETS_PER_PARTITION(hash_table->size_log2) / 2 + \ BUCKETS_PER_PARTITION(hash_table->size_log2) / 4) I'm failing to understand why the maximum number of hash table entries in a partition should be smaller than the number of buckets in that partition. The fact that MAX_COUNT_PER_PARTITION refers to entries and not buckets is obvious from this condition in dshash_find_or_insert() /* Check if we are getting too full. */ if (partition->count > MAX_COUNT_PER_PARTITION(hash_table)) -- Antonin Houska Cybertec Schönig & Schönig GmbH Gröhrmühlgasse 26, A-2700 Wiener Neustadt Web: https://www.cybertec-postgresql.com

view thread (7+ messages)  latest in thread

Message-ID: <8726.1540553521@localhost>
Permalink:  ../8726.1540553521@localhost/
Also on:    postgresql.org/message-id/8726.1540553521@localhost

 ·  · 

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-hackers@postgresql.org
  Cc: ah@cybertec.at
  Subject: Re: Comment fix and question about dshash.c
  In-Reply-To: <8726.1540553521@localhost>

* 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