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

Commit92f3750

Browse files
Fix nbtree maximum item size macro.
Commitdd299df, which made heap TID a tiebreaker nbtree indexcolumn, introduced new rules on page space management to make suffixtruncation safe for v4+ indexes. New pivot tuples (generated by suffixtruncation during leaf page splits) sometimes require dedicated extraspace at the end of a new leaf page high key/pivot to store a heap TIDusing a special representation (a representation only used in pivottuples).The definition of "1/3 of a page" was reduced by a single MAXALIGN()quantum for v4 indexes to make sure that the final enlarged pivot tuplealways fit, even with a split point whose firstright tuple happened toalready be at the "1/3 of a page" limit (limit for non-pivot tuples).Internal pages (which only contain pivot tuples) stuck with the original"1/3 of a page" definition. This scheme made it impossible for any pagesplit to fail to free enough space for its newitem, which is never okay.The macro that determines whether non-pivot tuples exceed their "1/3 ofa leaf page" restriction was structured as if space was needed for allthree tuples during a leaf page split (the new pivot plus two very largeadjoining non-pivots that are separated by the split). This was subtlywrong, in that it accidentally relied on implementation details thatcould (at least in theory) change in the future.To fix, make the macro subtract a single MAXALIGN() quantum, once. Themacro evaluates to exactly the same value as before in practice. But itno longer depends on the current layout of nbtree's special area struct.No backpatch, since this isn't a live bug.Author: Peter Geoghegan <pg@bowt.ie>Reported-By: Robert Haas <robertmhaas@gmail.com>Diagnosed-By: Robert Haas <robertmhaas@gmail.com>Discussion:https://postgr.es/m/CA+Tgmoa7UBxivM7f6Ocx_qbq4=ky3uXc+WZNOBcVX+kvJvWOEA@mail.gmail.com
1 parenta0dc827 commit92f3750

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

‎src/include/access/nbtree.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,9 @@ typedef struct BTMetaPageData
163163
*/
164164
#defineBTMaxItemSize(page) \
165165
MAXALIGN_DOWN((PageGetPageSize(page) - \
166-
MAXALIGN(SizeOfPageHeaderData + \
167-
3*sizeof(ItemIdData) + \
168-
3*sizeof(ItemPointerData)) - \
169-
MAXALIGN(sizeof(BTPageOpaqueData))) / 3)
166+
MAXALIGN(SizeOfPageHeaderData + 3*sizeof(ItemIdData)) - \
167+
MAXALIGN(sizeof(BTPageOpaqueData))) / 3) - \
168+
MAXALIGN(sizeof(ItemPointerData))
170169
#defineBTMaxItemSizeNoHeapTid(page) \
171170
MAXALIGN_DOWN((PageGetPageSize(page) - \
172171
MAXALIGN(SizeOfPageHeaderData + 3*sizeof(ItemIdData)) - \

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp