Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3bdca3d

Browse files
committed
Insert new item in the end of the page if it is the biggest item
1 parent a1da826 commit 3bdca3d

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/rumdatapage.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ rumMergeItemPointers(RumState * rumstate, AttrNumber attno, RumKey * dst,
409409

410410
/*
411411
* Checks, should we move to right link...
412-
* Compares inserting itemp pointer with right bound of current page
412+
* Compares inserting item pointer with right bound of current page
413413
*/
414414
static bool
415415
dataIsMoveRight(RumBtree btree, Page page)
@@ -909,7 +909,9 @@ dataPlaceToPage(RumBtree btree, Page page, OffsetNumber off)
909909
if (stopAppend)
910910
/* there is no free space on page */
911911
break;
912-
else if (RumPageRightMost(page))
912+
else if (RumPageRightMost(page) ||
913+
/* Insert item in the end of the page */
914+
off > maxoff)
913915
/* force insertion of new item */
914916
cmp = 1;
915917
else if ((cmp = compareRumKey(btree->rumstate, btree->entryAttnum,
@@ -1211,7 +1213,7 @@ dataSplitPageInternal(RumBtree btree, Buffer lbuf, Buffer rbuf,
12111213
OffsetNumber separator;
12121214
RumKey* bound;
12131215
Page newlPage = PageGetTempPageCopy(BufferGetPage(lbuf));
1214-
RumKey oldbound = *RumDataPageGetRightBound(newlPage);
1216+
RumKey oldbound = *RumDataPageGetRightBound(newlPage);
12151217
int sizeofitem = sizeof(PostingItem);
12161218
OffsetNumber maxoff = RumPageGetOpaque(newlPage)->maxoff;
12171219
Size pageSize = PageGetPageSize(newlPage);

src/ruminsert.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ createPostingTree(RumState * rumstate, OffsetNumber attnum, Relation index,
9999
* are making a leaf-level key entry containing a posting list of nipd items.
100100
* If the caller is actually trying to make a posting-tree entry, non-leaf
101101
* entry, or pending-list entry, it should pass nipd = 0 and then overwrite
102-
* the t_tid fields as necessary. In any case, ipd can be NULL to skip
102+
* the t_tid fields as necessary. In any case, items can be NULL to skip
103103
* copying any itempointers into the posting list; the caller is responsible
104-
* for filling the posting list afterwards, if ipd = NULL and nipd > 0.
104+
* for filling the posting list afterwards, if items = NULL and nipd > 0.
105105
*/
106106
static IndexTuple
107107
RumFormTuple(RumState * rumstate,
@@ -348,7 +348,6 @@ buildFreshLeafTuple(RumState * rumstate,
348348
if (size >= RumDataPageSize)
349349
itemsCount--;
350350

351-
352351
/*
353352
* Build posting-tree-only result tuple. We do this first so as to
354353
* fail quickly if the key is too big.

0 commit comments

Comments
 (0)