Re: error context for vacuum to include block number
Justin Pryzby <pryzby@telsasoft.com>
From: Justin Pryzby <pryzby@telsasoft.com>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Masahiko Sawada <masahiko.sawada@2ndquadrant.com>, Andres Freund <andres@anarazel.de>, Michael Paquier <michael@paquier.xyz>, pgsql-hackers@postgresql.org
Date: 2020-02-27T21:08:13Z
Lists: pgsql-hackers
Attachments
On Thu, Feb 20, 2020 at 02:02:36PM -0300, Alvaro Herrera wrote: > On 2020-Feb-19, Justin Pryzby wrote: > > > Also, I was thinking that lazy_scan_heap doesn't needs to do this: > > > > + /* Pop the error context stack while calling vacuum */ > > + error_context_stack = errcallback.previous; > > ... > > + /* Set the error context while continuing heap scan */ > > + error_context_stack = &errcallback; > > > > It seems to me that's not actually necessary, since lazy_vacuum_heap will just > > *push* a context handler onto the stack, and then pop it back off. > > So if you don't pop before pushing, you'll end up with two context > lines, right? Hm, looks like you're right, but that's not what I intended (and I didn't hit that in my test). > I think it would make sense to > initialize the context callback just *once* for a vacuum run, and from > that point onwards, just update the errcbarg struct to match what > you're currently doing -- not continually pop/push error callback stack > entries. See below ... Originally, the patch only supported "scanning heap", and set the callback strictly, to avoid having callback installed when calling other functions (like vacuuming heap/indexes). Then incrementally added callbacks in increasing number of places. We only need one errcontext. And possibly you're right that the callback could always be in place (?). But what about things like vacuuming FSM ? I think we'd need another "phase" for that (or else invent a PHASE_IGNORE to do nothing). Would VACUUM_FSM be added to progress reporting, too? We're also talking about new phase for TRUNCATE_PREFETCH and TRUNCATE_WAIT. Regarding the cbarg, at one point I took a suggestion from Andres to use the LVRelStats struct. I got rid of that since I didn't like sharing "blkno" between heap scanning and heap vacuuming, and needs to be reset when switching back to scanning heap. I experimented now going back to that now. The only utility is in having an single allocation of relname/space. -- Justin
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