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

Commit 91a33ce

Browse files
committed
Force insertion of new items to the end of page.
It is necessary if curent item is greater than last item of the page.
1 parent 187309b commit 91a33ce

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/rumdatapage.c

+16-3
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ convertIndexToKey(RumDataLeafItemIndex *src, RumKey *dst)
520520
}
521521
}
522522

523-
/**
523+
/*
524524
* Find item pointer in leaf data page. Returns true if given item pointer is
525525
* found and false if it's not. Sets offset and iptrOut to last item pointer
526526
* which is less than given one. Sets ptrOut ahead that item pointer.
@@ -874,6 +874,13 @@ dataPlaceToPage(RumBtree btree, Page page, OffsetNumber off)
874874
copyPtr = pageCopy + (ptr - page);
875875
copyItem.iptr = iptr;
876876
}
877+
else
878+
{
879+
/*
880+
* Force insertion of new items until insertion items are less than
881+
* right bound.
882+
*/
883+
}
877884

878885
freespace = RumPageGetOpaque(page)->freespace;
879886

@@ -907,7 +914,7 @@ dataPlaceToPage(RumBtree btree, Page page, OffsetNumber off)
907914
{
908915
/* we copied all old items but we have to add more new items */
909916
if (stopAppend)
910-
/* there is no free space on page */
917+
/* there is no free space on page */
911918
break;
912919
else if (RumPageRightMost(page))
913920
/* force insertion of new item */
@@ -916,7 +923,13 @@ dataPlaceToPage(RumBtree btree, Page page, OffsetNumber off)
916923
RumDataPageGetRightBound(page),
917924
btree->items + btree->curitem)) >= 0)
918925
{
919-
/* force insertion of new item */
926+
/*
927+
* Force insertion if current item is greater than last item
928+
* of the page but less than right bound.
929+
*/
930+
if (off > maxoff)
931+
/* force insertion of new item */
932+
cmp = 1;
920933
}
921934
else
922935
/* new items should be inserted on next page */

0 commit comments

Comments
 (0)