simplehash: tb->sizemask = 0

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: simplehash: tb->sizemask = 0
Date: 2017-11-27 20:34:52
Message-ID: ad325190-4957-200b-7f1c-f2b936bfe74d@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I'm a bit puzzled by this code in SH_COMPUTE_PARAMETERS:

if (tb->size == SH_MAX_SIZE)
tb->sizemask = 0;
else
tb->sizemask = tb->size - 1;

Doesn't that mean that with SH_MAX_SIZE we end up with sizemask being 0
(i.e. no bits set)? At least that's what I get from

printf("%#x\n", (unsigned int)0);

That would mean SH_INITIAL_BUCKET/SH_NEXT/SH_PREV can only ever return
bucket 0, no?

I don't think we're building hash tables with 2^32 buckets, though.

regards

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-11-27 21:01:07 Re: default range partition and constraint exclusion
Previous Message Peter Geoghegan 2017-11-27 20:04:12 Re: [HACKERS] Challenges preventing us moving to 64 bit transaction id (XID)?