Re: error context for vacuum to include block number
Masahiko Sawada <masahiko.sawada@2ndquadrant.com>
From: Masahiko Sawada <masahiko.sawada@2ndquadrant.com>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Andres Freund <andres@anarazel.de>, Michael Paquier <michael@paquier.xyz>, Alvaro Herrera <alvherre@2ndquadrant.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2020-02-18T09:18:16Z
Lists: pgsql-hackers
On Mon, 17 Feb 2020 at 15:14, Justin Pryzby <pryzby@telsasoft.com> wrote: > > On Mon, Feb 17, 2020 at 02:18:11PM +0900, Masahiko Sawada wrote: > > Oops it seems to me that it's better to set error context after > > tupindex = 0. Sorry for my bad. > > I take your point but did it differently - see what you think > > > And the above comment can be written in a single line as other same comments. > > Thanks :) > > > Hmm I don't think it's a good idea to have count_nondeletable_pages > > set the error context of PHASE_TRUNCATE. > > I think if we don't do it there then we shouldn't bother handling > PHASE_TRUNCATE at all, since that's what's likely to hit filesystem or other > lowlevel errors, before lazy_truncate_heap() hits them. > > > Because the patch sets the > > error context during RelationTruncate that actually truncates the heap > > but count_nondeletable_pages doesn't truncate it. > > I would say that ReadBuffer called by the prefetch in > count_nondeletable_pages() is called during the course of truncation, the same > as ReadBuffer called during the course of vacuuming can be attributed to > vacuuming. Why do we want to include only count_nondeletable_pages in spite of that there are also several places where we may wait: waiting for lock, get the number of blocks etc. User may cancel vacuum during them but user will not be able to know that vacuum is in truncation phase. If we want to set the error callback during operation that actually doesn't truncate heap like count_nondeletable_pages we should set it for whole lazy_truncate_heap. Otherwise I think we should set it for only RelationTruncate. > > > I think setting the error context only during RelationTruncate would be a > > good start. We can hear other opinions from other hackers. Some hackers may > > want to set the error context for whole lazy_truncate_heap. > > I avoided doing that since it has several "return" statements, each of which > would need to "Pop the error context stack", which is at risk of being > forgotten and left unpopped by anyone who adds or changes flow control. I imagined that we can add some goto and pop the error callback there. But since it might make the code bad I suggested to set the error callback for only RelationTruncate as the first step Regards, -- Masahiko Sawada http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
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