• Heikki Linnakangas's avatar
    Change the way parent pages are tracked during buffered GiST build. · d1996ed5
    Heikki Linnakangas authored
    We used to mimic the way a stack is constructed when descending the tree
    during normal GiST inserts, but that was quite complicated during a buffered
    build. It was also wrong: in GiST, the left-to-right relationships on
    different levels might not match each other, so that when you know the
    parent of a child page, you won't necessarily find the parent of the page to
    the right of the child page by following the rightlinks at the parent level.
    This sometimes led to "could not re-find parent" errors while building a
    GiST index.
    
    We now use a simple hash table to track the parent of every internal page.
    Whenever a page is split, and downlinks are moved from one page to another,
    we update the hash table accordingly. This is also better for performance
    than the old method, as we never need to move right to re-find the parent
    page, which could take a significant amount of time for buffers that were
    created much earlier in the index build.
    d1996ed5
gist_private.h 18.2 KB