Fix multi-table VACUUM VERBOSE accounting.
authorPeter Geoghegan <pg@bowt.ie>
Fri, 15 Apr 2022 22:48:39 +0000 (15:48 -0700)
committerPeter Geoghegan <pg@bowt.ie>
Fri, 15 Apr 2022 22:48:39 +0000 (15:48 -0700)
commitd3609dd2547b3ed807bc3b6dd27a008d65e86668
tree2b386e741efd3cb3baa41c0e66a2458d34f70a65
parent7129a9791eafdd825eae0187b7dd7b99ed48fdc7
Fix multi-table VACUUM VERBOSE accounting.

Per-backend global variables like VacuumPageHit are initialized once per
VACUUM command.  This was missed by commit 49c9d9fc, which unified
VACUUM VERBOSE and autovacuum logging.  As a result of that oversight,
incorrect values were shown when multiple relations were processed by a
single VACUUM VERBOSE command.

Relations that happened to be processed later on would show "buffer
usage:" values that incorrectly included buffer accesses made while
processing earlier unrelated relations.  The same accesses were counted
multiple times.

To fix, take initial values for the tracker variables at the start of
heap_vacuum_rel(), and report delta values later on.
src/backend/access/heap/vacuumlazy.c