• Peter Geoghegan's avatar
    Fix another minor page deletion buffer lock issue. · 7154aa16
    Peter Geoghegan authored
    Avoid accessing the leaf page's top parent tuple without a buffer lock
    held during the second phase of nbtree page deletion.  The old approach
    was safe, though only because VACUUM never drops its buffer pin (and
    because only VACUUM itself can modify a half-dead page).  Even still, it
    seems like a good idea to be strict here.  Tighten things up by copying
    the top parent page's block number to a local variable before releasing
    the buffer lock on the leaf page -- not after.
    
    This is a follow-up to commit fa7ff642, which fixed a similar issue in
    the first phase of nbtree page deletion.
    
    Update some related comments in passing.
    
    Discussion: https://postgr.es/m/CAH2-WzkLgyN3zBvRZ1pkNJThC=xi_0gpWRUb_45eexLH1+k2_Q@mail.gmail.com
    7154aa16
nbtpage.c 71.8 KB