Notice that heap page has dead items during VACUUM.
authorPeter Geoghegan <pg@bowt.ie>
Mon, 15 Mar 2021 01:05:57 +0000 (18:05 -0700)
committerPeter Geoghegan <pg@bowt.ie>
Mon, 15 Mar 2021 01:05:57 +0000 (18:05 -0700)
commit0ea71c93a06ddc38e0b72e48f1d512e5383a9c1b
treee80bf876fd6842b244a1944f16b17b11647bd254
parent58f57490facdec78119e5bab84229dbdc1d5ac6a
Notice that heap page has dead items during VACUUM.

Consistently set a flag variable that tracks whether the current heap
page has a dead item during lazy vacuum's heap scan.  We missed the
common case where there is an preexisting (or even a new) LP_DEAD heap
line pointer.

Also make it clear that the variable might be affected by an existing
line pointer, say from an earlier opportunistic pruning operation.  This
distinction is important because it's the main reason why we can't just
use the nearby tups_vacuumed variable instead.

No backpatch.  In theory failing to set the page level flag variable had
no consequences.  Currently it is only used to defensively check if a
page marked all visible has dead items, which should never happen anyway
(if it does then the table must be corrupt).

Author: Masahiko Sawada <sawada.mshk@gmail.com>
Diagnosed-By: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/CAD21AoAtZb4+HJT_8RoOXvu4HM-Zd4HKS3YSMCH6+-W=bDyh-w@mail.gmail.com
src/backend/access/heap/vacuumlazy.c