Re: error context for vacuum to include block number

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: error context for vacuum to include block number
Date: 2020-03-03 19:32:05
Message-ID: 20200303193205.GG684@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 27, 2020 at 09:09:42PM -0300, Alvaro Herrera wrote:
> > + case PROGRESS_VACUUM_PHASE_VACUUM_HEAP:
> > + if (BlockNumberIsValid(cbarg->blkno))
> > + errcontext("while vacuuming block %u of relation \"%s.%s\"",
> > + cbarg->blkno, cbarg->relnamespace, cbarg->relname);
> > + break;
>
> I think you should still call errcontext() when blkno is invalid.

In my experience while testing, the conditional avoids lots of CONTEXT noise
from interrupted autovacuum, at least. I couldn't easily reproduce it with the
current patch, though, maybe due to less pushing and popping.

> Maybe it would make sense to make the LVRelStats struct members be char
> arrays rather than pointers. Then you memcpy() or strlcpy() them
> instead of palloc/free.

I had done that in the v15 patch, to allow passing it to parallel workers.
But I don't think it's really needed.

On Tue, Mar 03, 2020 at 10:05:42PM +0900, Masahiko Sawada wrote:
> I was concerned about fsm vacuum; vacuum error context might show heap
> scan while actually doing fsm vacuum. But perhaps we can update
> callback args for that. That would be helpful for user to distinguish
> that the problem seems to be either in heap vacuum or in fsm vacuum.

Done in the attached. But I think non-error reporting of additional progress
phases is out of scope for this patch.

> On Fri, 21 Feb 2020 at 02:02, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote:
> > parallel children will need to "init" on their own, right?
> Right. In that case, I think parallel vacuum worker needs to init the
> callback args at parallel_vacuum_main(). Other functions that parallel
> vacuum worker could call are also called by the leader process.

In the previous patch, I added this to vacuum_one_index. But I noticed that
sometimes reported multiple CONTEXT lines (while vacuuming..while scanning),
which isn't intended. I was hacked around that by setting ->previous=NULL, but
your way in parallel main() seems better.

--
Justin

Attachment Content-Type Size
v23-0001-vacuum-errcontext-to-show-block-being-processed.patch text/x-diff 17.1 KB
v23-0002-add-callback-for-truncation.patch text/x-diff 2.6 KB
v23-0003-Avoid-some-calls-to-RelationGetRelationName.patch text/x-diff 3.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Cary Huang 2020-03-03 19:36:05 Re: [PATCH] Documentation bug related to client authentication using TLS certificate
Previous Message David Steele 2020-03-03 19:11:41 Re: Option to dump foreign data in pg_dump