• Peter Geoghegan's avatar
    nbtree: Use raw PageAddItem() for retail inserts. · 6312c08a
    Peter Geoghegan authored
    Only internal page splits need to call _bt_pgaddtup() instead of
    PageAddItem(), and only for data items, one of which will end up at the
    first offset (or first offset after the high key offset) on the new
    right page.  This data item alone will need to be truncated in
    _bt_pgaddtup().
    
    Since there is no reason why retail inserts ever need to truncate the
    incoming item, use a raw PageAddItem() call there instead.  Even
    _bt_split() uses raw PageAddItem() calls for left page and right page
    high keys.  Clearly the _bt_pgaddtup() shim function wasn't really
    encapsulating anything.  _bt_pgaddtup() should now be thought of as a
    _bt_split() helper function.
    
    Note that the assertions from commit d1e241c2 verify that retail inserts
    never insert an item at an internal page's negative infinity offset.
    This invariant could only ever be violated as a result of a basic logic
    error in nbtinsert.c.
    6312c08a
nbtinsert.c 89.5 KB