]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix parallel vacuum buffer usage reporting.
authorMasahiko Sawada <msawada@postgresql.org>
Wed, 1 May 2024 03:34:01 +0000 (12:34 +0900)
committerMasahiko Sawada <msawada@postgresql.org>
Wed, 1 May 2024 03:34:01 +0000 (12:34 +0900)
commitfaba2f8f35df8cd07cd2205b0bb4815a10c38b14
tree36c0b56314e012352936037260fdc0000983da03
parent52f21f928732418b333232a36fb02890f9c87b52
Fix parallel vacuum buffer usage reporting.

A parallel worker's buffer usage is accumulated to its pgBufferUsage
and then is accumulated into the leader's one at the end of the
parallel vacuum. However, since the leader process used to use
dedicated VacuumPage{Hit, Miss, Dirty} globals for the buffer usage
reporting, the worker's buffer usage was not included, leading to an
incorrect buffer usage report.

To fix the problem, this commit makes vacuum use pgBufferUsage
instruments for buffer usage reporting instead of VacuumPage{Hit,
Miss, Dirty} globals. These global variables are still used by ANALYZE
command and autoanalyze.

This also fixes the buffer usage report of vacuuming on temporary
tables, since the buffers dirtied by MarkLocalBufferDirty() were not
tracked by the VacuumPageDirty variable.

Parallel vacuum was introduced in 13, but the buffer usage reporting
for VACUUM command with the VERBOSE option was implemented in
15. So backpatch to 15.

Reported-by: Anthonin Bonnefoy
Author: Anthonin Bonnefoy
Reviewed-by: Alena Rybakina, Masahiko Sawada
Discussion: https://postgr.es/m/CAO6_XqrQk+QZQcYs_C6nk0cMfHuUWk85vT9CrcA1NffFbAVE2A@mail.gmail.com
Backpatch-through: 15
src/backend/access/heap/vacuumlazy.c