From 5230b7875bf638992e222c518b48021105ffa350 Mon Sep 17 00:00:00 2001 From: Bharath Rupireddy Date: Mon, 27 Jul 2026 22:54:13 +0000 Subject: [PATCH v1] Fix stale comment in parallel_vacuum_main(). The comment stated parallel index vacuum is not supported for autovacuum, but commit 1ff3180ca01 enabled autovacuum to use parallel vacuum workers. The assertion still holds. The leader sets PROC_IN_VACUUM and the worker inherits it when importing the leader's snapshot, while PROC_IS_AUTOVACUUM is never set on the parallel worker nor carried over. Reword the comment to explain that. Backpatch to v19, where 1ff3180ca01 was introduced. Author: Bharath Rupireddy --- src/backend/commands/vacuumparallel.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/backend/commands/vacuumparallel.c b/src/backend/commands/vacuumparallel.c index 41cefcfde54..730a6472644 100644 --- a/src/backend/commands/vacuumparallel.c +++ b/src/backend/commands/vacuumparallel.c @@ -1209,8 +1209,15 @@ parallel_vacuum_main(dsm_segment *seg, shm_toc *toc) ErrorContextCallback errcallback; /* - * A parallel vacuum worker must have only PROC_IN_VACUUM flag since we - * don't support parallel vacuum for autovacuum as of now. + * A parallel vacuum worker carries only the PROC_IN_VACUUM flag. The + * leader, whether it's a backend running a VACUUM command or an + * autovacuum worker, sets PROC_IN_VACUUM when it starts vacuuming the + * table, and the worker inherits the flag by importing the leader's + * snapshot (see ProcArrayInstallRestoredXmin). PROC_IS_AUTOVACUUM never + * reaches the worker, even under parallel autovacuum, because parallel + * workers are launched as regular background workers rather than + * autovacuum workers, so the flag is never set on them and the snapshot + * import doesn't carry it over. */ Assert(MyProc->statusFlags == PROC_IN_VACUUM); -- 2.47.3