pgsql: Fix some problems with VACUUM (INDEX_CLEANUP FALSE).

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix some problems with VACUUM (INDEX_CLEANUP FALSE).
Date: 2019-05-02 14:19:31
Message-ID: E1hMCYd-00045b-4V@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix some problems with VACUUM (INDEX_CLEANUP FALSE).

The new nleft_dead_tuples and nleft_dead_itemids fields are confusing
and do not seem like the correct way forward. One of them is tested
via an assertion that can fail, as it has already done on buildfarm
member topminnow. Remove the assertion and the fields.

Change the logic for the case where a tuple is not initially pruned
by heap_page_prune but later diagnosed HEAPTUPLE_DEAD by
HeapTupleSatisfiesVacuum. Previously, tupgone = true was set in
that case, which leads to treating the tuple as one that will be
removed. In a normal vacuum, that's OK, because we'll remove
index entries for it and then the second heap pass will remove the
tuple itself, but when index cleanup is disabled, those things
don't happen, so we must instead treat it as a recently-dead
tuple that we have voluntarily chosen to keep.

Report and analysis by Tom Lane. This patch loosely based on one
from Masahiko Sawada, but I changed most of it.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/dd69597988859c51131e0cbff3e30432db4259e1

Modified Files
--------------
src/backend/access/heap/vacuumlazy.c | 45 ++++++++----------------------------
1 file changed, 9 insertions(+), 36 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2019-05-02 19:34:10 pgsql: Fix nbtsort.c's page space accounting.
Previous Message Robert Haas 2019-05-01 17:10:40 Re: pgsql: Compute XID horizon for page level index vacuum on primary.