v22--v23-diff-for-0002.patch
text/x-patch
Filename: v22--v23-diff-for-0002.patch
Type: text/x-patch
Part: 8
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v22
Subject: fixes for 0002 patch
| File | + | − |
|---|---|---|
| src/backend/access/heap/vacuumlazy.c | 1 | 8 |
| src/backend/commands/vacuumparallel.c | 3 | 0 |
| src/include/commands/vacuum.h | 16 | 5 |
| src/tools/pgindent/typedefs.list | 0 | 1 |
From bc4479dab3a81fc26e15b55f1c053c46c6cc5279 Mon Sep 17 00:00:00 2001
From: Daniil Davidov <d.davydov@postgrespro.ru>
Date: Sat, 28 Feb 2026 18:11:58 +0700
Subject: [PATCH] fixes for 0002 patch
---
src/backend/access/heap/vacuumlazy.c | 9 +--------
src/backend/commands/vacuumparallel.c | 3 +++
src/include/commands/vacuum.h | 21 ++++++++++++++++-----
src/tools/pgindent/typedefs.list | 1 -
4 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 055ddf566dc..1e2d5be1af2 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -348,6 +348,7 @@ typedef struct LVRelState
* index scans.
*/
PVWorkersUsage workers_usage;
+
/* Counters that follow are only for scanned_pages */
int64 tuples_deleted; /* # deleted from table */
int64 tuples_frozen; /* # newly frozen */
@@ -1135,11 +1136,8 @@ heap_vacuum_rel(Relation rel, const VacuumParams params,
vacrel->lpdead_items);
if (vacrel->workers_usage.vacuum.nplanned > 0)
{
- /* Stats for vacuum phase of index vacuuming. */
-
if (AmAutoVacuumWorkerProcess())
{
- /* Worker usage stats for parallel autovacuum. */
appendStringInfo(&buf,
_("parallel workers: index vacuum: %d planned, %d reserved, %d launched in total\n"),
vacrel->workers_usage.vacuum.nplanned,
@@ -1148,7 +1146,6 @@ heap_vacuum_rel(Relation rel, const VacuumParams params,
}
else
{
- /* Worker usage stats for manual VACUUM (PARALLEL). */
appendStringInfo(&buf,
_("parallel workers: index vacuum: %d planned, %d launched in total\n"),
vacrel->workers_usage.vacuum.nplanned,
@@ -1157,11 +1154,8 @@ heap_vacuum_rel(Relation rel, const VacuumParams params,
}
if (vacrel->workers_usage.cleanup.nplanned > 0)
{
- /* Stats for cleanup phase of index vacuuming. */
-
if (AmAutoVacuumWorkerProcess())
{
- /* Worker usage stats for parallel autovacuum. */
appendStringInfo(&buf,
_("parallel workers: index cleanup: %d planned, %d reserved, %d launched\n"),
vacrel->workers_usage.cleanup.nplanned,
@@ -1170,7 +1164,6 @@ heap_vacuum_rel(Relation rel, const VacuumParams params,
}
else
{
- /* Worker usage stats for manual VACUUM (PARALLEL). */
appendStringInfo(&buf,
_("parallel workers: index cleanup: %d planned, %d launched\n"),
vacrel->workers_usage.cleanup.nplanned,
diff --git a/src/backend/commands/vacuumparallel.c b/src/backend/commands/vacuumparallel.c
index 177264cb2e6..643849b2fb8 100644
--- a/src/backend/commands/vacuumparallel.c
+++ b/src/backend/commands/vacuumparallel.c
@@ -619,6 +619,9 @@ parallel_vacuum_compute_workers(Relation *indrels, int nindexes, int nrequested,
/*
* Perform index vacuum or index cleanup with parallel workers. This function
* must be used by the parallel vacuum leader process.
+ *
+ * If wstats is not NULL, the statistics it stores will be updated according
+ * to what happens during function execution.
*/
static void
parallel_vacuum_process_all_indexes(ParallelVacuumState *pvs, int num_index_scans,
diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h
index d3dc4e8cc67..1b1fb625cb2 100644
--- a/src/include/commands/vacuum.h
+++ b/src/include/commands/vacuum.h
@@ -305,11 +305,22 @@ typedef struct VacDeadItemsInfo
*/
typedef struct PVWorkersStats
{
- int nplanned; /* # of parallel workers we are planned to
- * launch */
- int nreserved; /* for autovacuum only - # of parallel workers
- * we have managed to reserve */
- int nlaunched; /* # of launched parallel workers */
+ /* Number of parallel workers we are planned to launch */
+ int nplanned;
+
+ /*
+ * Number of parallel workers we have managed to reserve.
+ *
+ * Note, that we collect this stats only for the parallel *autovacuum*
+ * since during it we must reserve workers in shared state before actually
+ * trying to launch them (in order to meet the
+ * autovacuum_max_parallel_workers limit). Manual VACUUM (PARALLEL), on
+ * the contrary, doesn't need to reserve workers.
+ */
+ int nreserved;
+
+ /* Number of launched parallel workers */
+ int nlaunched;
} PVWorkersStats;
/*
diff --git a/src/tools/pgindent/typedefs.list b/src/tools/pgindent/typedefs.list
index 6ceb6cac14f..536237ff546 100644
--- a/src/tools/pgindent/typedefs.list
+++ b/src/tools/pgindent/typedefs.list
@@ -2410,7 +2410,6 @@ PullFilterOps
PushFilter
PushFilterOps
PushFunction
-PVWorkersUsage
PyCFunction
PyMethodDef
PyModuleDef
--
2.43.0