From 0a7a0dec24b3f1143d2c3c240b0f823d750b86a6 Mon Sep 17 00:00:00 2001 From: Bharath Rupireddy Date: Sun, 13 Sep 2026 06:58:05 +0000 Subject: [PATCH v7 2/2] Remove IndexVacuumInfo.report_progress. Commit ab0dfc961b6a, which added progress reporting for CREATE INDEX, introduced report_progress so that the block counters PROGRESS_SCAN_BLOCKS_TOTAL and PROGRESS_SCAN_BLOCKS_DONE were reported only during index validation. Commit XXXX now enables vacuum to report them as well, so every caller sets the field to true. B-tree is the only access method that reads it. Remove the field and report the counters unconditionally in btvacuumscan(). An out-of-tree index access method that sets report_progress needs a trivial adjustment. Author: Bharath Rupireddy Discussion: https://postgr.es/m/CALj2ACUgwSchK6jQ2CdKLBWUADTOE_zKdTff2Zg3E6hOuXKv-w@mail.gmail.com --- src/backend/access/heap/vacuumlazy.c | 2 -- src/backend/access/nbtree/nbtree.c | 9 +++------ src/backend/catalog/index.c | 1 - src/backend/commands/vacuumparallel.c | 1 - src/include/access/genam.h | 1 - 5 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c index a23af936b7f..44a7466def4 100644 --- a/src/backend/access/heap/vacuumlazy.c +++ b/src/backend/access/heap/vacuumlazy.c @@ -3048,7 +3048,6 @@ lazy_vacuum_one_index(Relation indrel, IndexBulkDeleteResult *istat, ivinfo.index = indrel; ivinfo.heaprel = vacrel->rel; ivinfo.analyze_only = false; - ivinfo.report_progress = true; ivinfo.estimated_count = true; ivinfo.message_level = DEBUG2; ivinfo.num_heap_tuples = reltuples; @@ -3114,7 +3113,6 @@ lazy_cleanup_one_index(Relation indrel, IndexBulkDeleteResult *istat, ivinfo.index = indrel; ivinfo.heaprel = vacrel->rel; ivinfo.analyze_only = false; - ivinfo.report_progress = true; ivinfo.estimated_count = estimated_count; ivinfo.message_level = DEBUG2; diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c index 0abdd7b49f5..a4c3ad1b0f6 100644 --- a/src/backend/access/nbtree/nbtree.c +++ b/src/backend/access/nbtree/nbtree.c @@ -1339,9 +1339,7 @@ btvacuumscan(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, if (needLock) UnlockRelationForExtension(rel, ExclusiveLock); - if (info->report_progress) - pgstat_progress_update_param(PROGRESS_SCAN_BLOCKS_TOTAL, - num_pages); + pgstat_progress_update_param(PROGRESS_SCAN_BLOCKS_TOTAL, num_pages); /* Quit if we've scanned the whole relation */ if (p.current_blocknum >= num_pages) @@ -1365,9 +1363,8 @@ btvacuumscan(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, current_block = btvacuumpage(&vstate, buf); - if (info->report_progress) - pgstat_progress_update_param(PROGRESS_SCAN_BLOCKS_DONE, - current_block); + pgstat_progress_update_param(PROGRESS_SCAN_BLOCKS_DONE, + current_block); } /* diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index ec21b83b6b8..a3768e8daf7 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -3455,7 +3455,6 @@ validate_index(Oid heapId, Oid indexId, Snapshot snapshot) ivinfo.index = indexRelation; ivinfo.heaprel = heapRelation; ivinfo.analyze_only = false; - ivinfo.report_progress = true; ivinfo.estimated_count = true; ivinfo.message_level = DEBUG2; ivinfo.num_heap_tuples = heapRelation->rd_rel->reltuples; diff --git a/src/backend/commands/vacuumparallel.c b/src/backend/commands/vacuumparallel.c index 607c57c8eba..fe388d99dc3 100644 --- a/src/backend/commands/vacuumparallel.c +++ b/src/backend/commands/vacuumparallel.c @@ -1098,7 +1098,6 @@ parallel_vacuum_process_one_index(ParallelVacuumState *pvs, Relation indrel, ivinfo.index = indrel; ivinfo.heaprel = pvs->heaprel; ivinfo.analyze_only = false; - ivinfo.report_progress = true; ivinfo.message_level = DEBUG2; ivinfo.estimated_count = pvs->shared->estimated_count; ivinfo.num_heap_tuples = pvs->shared->reltuples; diff --git a/src/include/access/genam.h b/src/include/access/genam.h index 72b256ecf43..07447bf1c4f 100644 --- a/src/include/access/genam.h +++ b/src/include/access/genam.h @@ -54,7 +54,6 @@ typedef struct IndexVacuumInfo Relation index; /* the index being vacuumed */ Relation heaprel; /* the heap relation the index belongs to */ bool analyze_only; /* ANALYZE (without any actual vacuum) */ - bool report_progress; /* emit progress.h status reports */ bool estimated_count; /* num_heap_tuples is an estimate */ int message_level; /* ereport level for progress messages */ double num_heap_tuples; /* tuples remaining in heap */ -- 2.47.3