Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit916afca

Browse files
author
Amit Kapila
committed
Fix the overrun in hash index metapage for smaller block sizes.
The commit620b49a changed the value of HASH_MAX_BITMAPS with the intentto allow many non-unique values in hash indexes without worrying to reachthe limit of the number of overflow pages. At that time, this didn'toccur 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 givesthe same answer as now for the cases where the overrun doesn't occur, andsome other sufficiently-value for the cases where an overrun currentlydoes occur. This allows us not to change the behavior in any case thatcurrently works, so there's really no reason for a HASH_VERSION bump.Author: Dilip KumarReviewed-by: Amit KapilaBackpatch-through: 10Discussion:https://postgr.es/m/CAA4eK1LtF4VmU4mx_+i72ff1MdNZ8XaJMGkt2HV8+uSWcn8t4A@mail.gmail.com
1 parent0f3637a commit916afca

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎src/include/access/hash.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,12 @@ typedef HashScanOpaqueData *HashScanOpaque;
182182
*
183183
* There is no particular upper limit on the size of mapp[], other than
184184
* needing to fit into the metapage. (With 8K block size, 1024 bitmaps
185-
* limit us to 256 GB of overflow space...)
185+
* limit us to 256 GB of overflow space...). For smaller block size we
186+
* can not use 1024 bitmaps as it will lead to the meta page data crossing
187+
* the block size boundary. So we use BLCKSZ to determine the maximum number
188+
* of bitmaps.
186189
*/
187-
#defineHASH_MAX_BITMAPS1024
190+
#defineHASH_MAX_BITMAPSMin(BLCKSZ / 8,1024)
188191

189192
#defineHASH_SPLITPOINT_PHASE_BITS2
190193
#defineHASH_SPLITPOINT_PHASES_PER_GRP(1 << HASH_SPLITPOINT_PHASE_BITS)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp