From b5461fd9a42f1c1b88f7edee630b9089d3d304b6 Mon Sep 17 00:00:00 2001 From: Peter Geoghegan Date: Sat, 30 Oct 2021 10:46:42 -0700 Subject: [PATCH v1 1/2] Fix parallel index vacuuming bug. --- src/backend/access/heap/vacuumlazy.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c index 05221cc1d..f40d3e19f 100644 --- a/src/backend/access/heap/vacuumlazy.c +++ b/src/backend/access/heap/vacuumlazy.c @@ -2879,17 +2879,17 @@ do_serial_processing_for_unsafe_indexes(LVRelState *vacrel, LVShared *lvshared) IndexBulkDeleteResult *istat; shared_istat = parallel_stats_for_idx(lvshared, idx); - - /* Skip already-complete indexes */ - if (shared_istat != NULL) - continue; - indrel = vacrel->indrels[idx]; /* - * We're only here for the unsafe indexes + * We're only here for the subset of indexes that are either too small + * to be worth vacuuming in parallel workers, or are parallel unsafe. + * + * XXX Why not just use parallelism for all parallel-safe indexes + * instead? */ - if (parallel_processing_is_safe(indrel, lvshared)) + if (shared_istat != NULL && + parallel_processing_is_safe(indrel, lvshared)) continue; /* Do vacuum or cleanup of the index */ -- 2.30.2