• Peter Geoghegan's avatar
    Harden nbtree page deletion. · c34787f9
    Peter Geoghegan authored
    Add some additional defensive checks in the second phase of index
    deletion to detect and report index corruption during VACUUM, and to
    avoid having VACUUM become stuck in more cases.  The code is still not
    robust in the presence of a circular chain of sibling links, though it's
    not clear whether that really matters.  This is follow-up work to commit
    3a01f68e.
    
    The new defensive checks rely on the assumption that there can be no
    more than one VACUUM operation running for an index at any given time.
    Remove an old comment suggesting that multiple concurrent VACUUMs need
    to be considered here.  This concern now seems highly unlikely to have
    any real validity, since we clearly rely on the same assumption in
    several other places.  For example, there are much more recent comments
    that appear in the same function (added by commit efada2b8) that make
    the same assumption.
    
    Also add a CHECK_FOR_INTERRUPTS() to the relevant code path.  Contrary
    to comments added by commit 3a01f68e, it is actually possible to handle
    interrupts here, at least in the common case where processing takes
    place at the leaf level.  We only hold a pin on leafbuf/target page when
    stepping right at the leaf level.
    
    No backpatch due to the lack of complaints following hardening added to
    the same area by commit 3a01f68e.
    c34787f9
nbtpage.c 92.6 KB