You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Rearrange lazy_scan_heap to avoid visibility map race conditions.
We must set the visibility map bit before releasing our exclusive lockon the heap page; otherwise, someone might clear the heap page bitbefore we set the visibility map bit, leading to a situation where thevisibility map thinks the page is all-visible but it's really not.This problem has existed since 8.4, but it wasn't critical before wehad index-only scans, since the worst case scenario was that the pagewouldn't get vacuumed until the next scan_all vacuum.Along the way, a couple of minor, related improvements: (1) if wepause the heap scan to do an index vac cycle, release any visibilitymap page we're holding, since really long-running pins are not goodfor a variety of reasons; and (2) warn if we see a page that's markedall-visible in the visibility map but not on the page level, sincethat should never happen any more (it was allowed in previousreleases, but not in 9.2).