• Peter Geoghegan's avatar
    Refactor nbtree deletion INCOMPLETE_SPLIT check. · cd8c73a3
    Peter Geoghegan authored
    Factor out code common to _bt_lock_branch_parent() and _bt_pagedel()
    into a new utility function.  This new function is used to check that
    the left sibling of a deletion target page does not have the
    INCOMPLETE_SPLIT page flag set.  If it is set then deletion is unsafe;
    there won't be a usable pivot tuple (with a downlink) in the parent page
    that points to the deletion target page.  The page deletion algorithm is
    not prepared to deal with that.  Also restructure an existing, related
    utility function that checks if the right sibling of the target page has
    the ISHALFDEAD page flag set.
    
    This organization highlights the symmetry between the two cases.  The
    goal is to make the design of page deletion clearer.  Both functions
    involve a sibling page with a flag that indicates that there was an
    interrupted operation (a page split or a page deletion) that resulted in
    a page pointed to by sibling pages, but not pointed to in the parent.
    And, both functions indicate if page deletion is unsafe due to the
    absence of a particular downlink in the parent page.
    cd8c73a3
nbtpage.c 76.5 KB