• Bruce Momjian's avatar
    btree source code cleanups: · 6f519ad0
    Bruce Momjian authored
    I refactored findsplitloc and checksplitloc so that the division of
    labor is more clear IMO. I pushed all the space calculation inside the
    loop to checksplitloc.
    
    I also fixed the off by 4 in free space calculation caused by
    PageGetFreeSpace subtracting sizeof(ItemIdData), even though it was
    harmless, because it was distracting and I felt it might come back to
    bite us in the future if we change the page layout or alignments.
    There's now a new function PageGetExactFreeSpace that doesn't do the
    subtraction.
    
    findsplitloc now tries the "just the new item to right page" split as
    well. If people don't like the refactoring, I can write a patch to just
    add that.
    
    Heikki Linnakangas
    6f519ad0
nbtinsert.c 55.4 KB