Fix the overrun in hash index metapage for smaller block sizes.
authorAmit Kapila <[email protected]>
Thu, 6 Sep 2018 04:37:18 +0000 (10:07 +0530)
committerAmit Kapila <[email protected]>
Thu, 6 Sep 2018 04:37:18 +0000 (10:07 +0530)
commit834bce0a5293424d127ab72440b9eacc8841051f
treec0430dce9f4c07edba2181d4a8e21fa35f7c8e92
parent235526a20a2efb199c4138c5d793260ce37d7231
Fix the overrun in hash index metapage for smaller block sizes.

The commit 620b49a1 changed the value of HASH_MAX_BITMAPS with the intent
to allow many non-unique values in hash indexes without worrying to reach
the limit of the number of overflow pages.  At that time, this didn't
occur to us that it can overrun the block for smaller block sizes.

Choose the value of HASH_MAX_BITMAPS based on BLCKSZ such that it gives
the same answer as now for the cases where the overrun doesn't occur, and
some other sufficiently-value for the cases where an overrun currently
does occur.  This allows us not to change the behavior in any case that
currently works, so there's really no reason for a HASH_VERSION bump.

Author: Dilip Kumar
Reviewed-by: Amit Kapila
Backpatch-through: 10
Discussion: https://postgr.es/m/CAA4eK1LtF4VmU4mx_+i72ff1MdNZ8XaJMGkt2HV8+uSWcn8t4A@mail.gmail.com
src/include/access/hash.h