From 8d23b2a7a921caf9e717a437c9de90c4d9eb2204 Mon Sep 17 00:00:00 2001
From: John Naylor <john.naylor@postgresql.org>
Date: Mon, 3 Mar 2025 17:40:38 +0700
Subject: [PATCH v1 2/3] Force shared TID store with a single vacuum worker

XXX not for commit
---
 src/backend/access/heap/vacuumlazy.c  | 4 +++-
 src/backend/commands/vacuumparallel.c | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index a5913668193..144be988bbe 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -3478,7 +3478,7 @@ dead_items_alloc(LVRelState *vacrel, int nworkers)
 	 * be used for an index, so we invoke parallelism only if there are at
 	 * least two indexes on a table.
 	 */
-	if (nworkers >= 0 && vacrel->nindexes > 1 && vacrel->do_index_vacuuming)
+	if (nworkers >= 0 && vacrel->nindexes > 0 && vacrel->do_index_vacuuming)
 	{
 		/*
 		 * Since parallel workers cannot access data in temporary tables, we
@@ -3514,6 +3514,8 @@ dead_items_alloc(LVRelState *vacrel, int nworkers)
 		}
 	}
 
+	elog(ERROR, "shoudn't reach here");
+
 	/*
 	 * Serial VACUUM case. Allocate both dead_items and dead_items_info
 	 * locally.
diff --git a/src/backend/commands/vacuumparallel.c b/src/backend/commands/vacuumparallel.c
index 2b9d548cdeb..1c2f9e34dd1 100644
--- a/src/backend/commands/vacuumparallel.c
+++ b/src/backend/commands/vacuumparallel.c
@@ -272,7 +272,7 @@ parallel_vacuum_init(Relation rel, Relation *indrels, int nindexes,
 	parallel_workers = parallel_vacuum_compute_workers(indrels, nindexes,
 													   nrequested_workers,
 													   will_parallel_vacuum);
-	if (parallel_workers <= 0)
+	if (false) //(parallel_workers <= 0)
 	{
 		/* Can't perform vacuum in parallel -- return NULL */
 		pfree(will_parallel_vacuum);
-- 
2.48.1

