simplehash: tb->sizemask = 0 - Mailing list pgsql-hackers

From Tomas Vondra
Subject simplehash: tb->sizemask = 0
Date
Msg-id ad325190-4957-200b-7f1c-f2b936bfe74d@2ndquadrant.com
Whole thread Raw
Responses Re: simplehash: tb->sizemask = 0  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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


pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: [HACKERS] Challenges preventing us moving to 64 bit transactionid (XID)?
Next
From: Robert Haas
Date:
Subject: Re: default range partition and constraint exclusion