Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gG0Jv-0000QF-Lz for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Oct 2018 11:30:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gG0Jt-0006My-DD for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Oct 2018 11:30:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gG0Jt-0006Lh-2X for pgsql-hackers@lists.postgresql.org; Fri, 26 Oct 2018 11:30:25 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by makus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gG0Jp-0007xL-Ak for pgsql-hackers@postgresql.org; Fri, 26 Oct 2018 11:30:23 +0000 Received: from smtp2.mailbox.org (unknown [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 6141C4BB17 for ; Fri, 26 Oct 2018 13:30:17 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id 0vqYRptqT7_E for ; Fri, 26 Oct 2018 13:30:15 +0200 (CEST) From: Antonin Houska To: pgsql-hackers@postgresql.org Subject: Comment fix and question about dshash.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 26 Oct 2018 13:32:01 +0200 Message-ID: <8726.1540553521@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 1. The return type of resize() function is void, so I propose part of the header comment to be removed: diff --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) =20 /* * Grow the hash table if necessary to the requested number of buckets. T= he - * requested size must be double some previously observed size. Returns t= rue - * 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 =3D 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)) --=20 Antonin Houska Cybertec Sch=C3=B6nig & Sch=C3=B6nig GmbH Gr=C3=B6hrm=C3=BChlgasse 26, A-2700 Wiener Neustadt Web: https://www.cybertec-postgresql.com