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

Commit930fd68

Browse files
committed
Revert the GinMaxItemSize calculation so that we fit 3 tuples per page.
Commit36a35c5 changed the divisor from 3 to 6, for no apparent reason.Reducing GinMaxItemSize like that created a dump/reload hazard: loading a9.3 database to 9.4 might fail with "index row size XXX exceeds maximum 1352for index ..." error. Revert the change.While we're at it, make the calculation slightly more accurate. It used todivide the available space on page by three, then subtractsizeof(ItemIdData), and finally round down. That's not totally accurate; theitem pointers for the three items are packed tight right after the pageheader, but there is alignment padding after the item pointers. Change thecalculation to reflect that, like BTMaxItemSize does. I tested this withdifferent block sizes on systems with 4- and 8-byte alignment, and the valueafter the final MAXALIGN_DOWN was the same with both methods on allconfigurations. So this does not make any difference currently, but let's betidy.Also add a comment explaining what the macro does.This fixes bug #12292 reported by Robert Thaler. Backpatch to 9.4, where thebug was introduced.
1 parent3b5a89c commit930fd68

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

‎src/include/access/gin_private.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,18 @@ typedef signed char GinNullCategory;
226226
#defineGinGetPosting(itup)((Pointer) ((char*)(itup) + GinGetPostingOffset(itup)))
227227
#defineGinItupIsCompressed(itup)(GinItemPointerGetBlockNumber(&(itup)->t_tid) & GIN_ITUP_COMPRESSED)
228228

229+
/*
230+
* Maximum size of an item on entry tree page. Make sure that we fit at least
231+
* three items on each page. (On regular B-tree indexes, we must fit at least
232+
* three items: two data items and the "high key". In GIN entry tree, we don't
233+
* currently store the high key explicitly, we just use the rightmost item on
234+
* the page, so it would actually be enough to fit two items.)
235+
*/
229236
#defineGinMaxItemSize \
230237
Min(INDEX_SIZE_MASK, \
231-
MAXALIGN_DOWN(((BLCKSZ - SizeOfPageHeaderData -\
232-
MAXALIGN(sizeof(GinPageOpaqueData))) / 6 - sizeof(ItemIdData))))
238+
MAXALIGN_DOWN(((BLCKSZ - \
239+
MAXALIGN(SizeOfPageHeaderData + 3 * sizeof(ItemIdData)) - \
240+
MAXALIGN(sizeof(GinPageOpaqueData))) / 3)))
233241

234242
/*
235243
* Access macros for non-leaf entry tuples

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp