Re: error context for vacuum to include block number (atomic progress update)
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Alvaro Herrera <alvherre@2ndquadrant.com>, Andres Freund <andres@anarazel.de>, pgsql-hackers@postgresql.org
Date: 2020-01-06T07:31:43Z
Lists: pgsql-hackers
On Sun, Dec 29, 2019 at 02:17:47PM -0600, Justin Pryzby wrote: > The behavior is different from before, but I think that's ok: the number of > scans is accurate, and the PHASE is accurate, even though it'll change a moment > later. pgstat_progress_update_multi_param() is useful when it comes to update multiple parameters at the same time consistently in a given progress phase. For example, in vacuum, when beginning the heap scan, the number of blocks to scan and the max number of dead tuples has to be updated at the same as the phase name, as things have to be reported consistently, so that's critical to be consistent IMO. Now, in this case, we are discussing about updating a parameter which is related to the index vacuuming phase, while switching at the same time to a different phase. I think that splitting both is not confusing here because the number of times vacuum indexes have been done is unrelated to the heap cleanup happening afterwards. On top of that the new code is more readable, and future callers of lazy_vacuum_heap() will never miss to update the progress reporting to the new phase. While on it, a "git grep -n" is showing me two places where we could care more about being consistent by using the multi-param version of progress reports when beginning a new progress phase: - reindex_index() - ReindexRelationConcurrently() One can also note the switch to PROGRESS_VACUUM_PHASE_INDEX_CLEANUP in lazy_scan_heap() but it can be discarded for the same reason as what has been refactored recently with the index vacuuming. -- Michael
Commits
-
Avoid calls to RelationGetRelationName() and RelationGetNamespace() in
- ef75140fe756 13.0 landed
-
Introduce vacuum errcontext to display additional information.
- b61d161c1463 13.0 landed
-
Fix mesurement of elapsed time during truncating heap in VACUUM.
- 007491979461 13.0 cited
-
Allow vacuum command to process indexes in parallel.
- 40d964ec997f 13.0 cited
-
Refactor code dedicated to index vacuuming in vacuumlazy.c
- 1ab41a3c8edc 13.0 landed
-
Remove duplicated progress reporting during heap scan of VACUUM
- e5a02e0fc68b 13.0 landed