]> granicus.if.org Git - postgresql/commitdiff
Fix formula in _hash_spareindex.
authorRobert Haas <rhaas@postgresql.org>
Tue, 4 Apr 2017 11:42:05 +0000 (07:42 -0400)
committerRobert Haas <rhaas@postgresql.org>
Tue, 4 Apr 2017 11:45:04 +0000 (07:45 -0400)
This was correct in earlier versions of the patch that lead to
commit ea69a0dead5128c421140dc53fac165ba4af8520, but somehow got
broken in the last version which I actually committed.

Mithun Cy, per an off-list report from Ashutosh Sharma

Discussion: http://postgr.es/m/CAD__OujbAwNU71v1y-RoQxZ8LZ6-V2UFTkex3v34MK6uZ3Xb5w@mail.gmail.com

src/backend/access/hash/hashutil.c

index d679cf0aed9a209ecf093531afba5c05b206b8d6..037582bd7927f65d51147b7fc993c21518f5a3c8 100644 (file)
@@ -174,7 +174,8 @@ _hash_spareindex(uint32 num_bucket)
 
        /* account for phases within current group */
        splitpoint_phases +=
-               (((num_bucket - 1) >> (HASH_SPLITPOINT_PHASE_BITS + 1)) &
+               (((num_bucket - 1) >>
+                 (splitpoint_group - (HASH_SPLITPOINT_PHASE_BITS + 1))) &
                 HASH_SPLITPOINT_PHASE_MASK);   /* to 0-based value. */
 
        return splitpoint_phases;