Re: error context for vacuum to include block number

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

On Sun, Jan 26, 2020 at 12:29:38PM -0800, Andres Freund wrote:
> > postgres=# SET client_min_messages=debug;SET statement_timeout=99; VACUUM (VERBOSE, PARALLEL 0) t;
> > INFO: vacuuming "public.t"
> > DEBUG: "t_a_idx": vacuuming index
> > 2020-01-20 15:47:36.338 CST [20139] ERROR: canceling statement due to statement timeout
> > 2020-01-20 15:47:36.338 CST [20139] CONTEXT: while vacuuming relation "public.t_a_idx"
> > 2020-01-20 15:47:36.338 CST [20139] STATEMENT: VACUUM (VERBOSE, PARALLEL 0) t;
> > ERROR: canceling statement due to statement timeout
> > CONTEXT: while vacuuming relation "public.t_a_idx"
>
> It'd be a bit nicer if it said index "public.t_a_idx" for relation "public.t".

I think that tips the scale in favour of making vacrelstats a global.
I added that as a 1st patch, and squished the callback patches into one.

Also, it seems to me we shouldn't repeat the namespace of the index *and* its
table. I tried looking for consistency here:

grep -r '\\"%s.%s\\"' --incl='*.c' |grep '\\"%s\\"'
src/backend/commands/cluster.c: (errmsg("clustering \"%s.%s\" using index scan on \"%s\"",
src/backend/access/heap/vacuumlazy.c: errcontext(_("while vacuuming index \"%s\" on table \"%s.%s\""),

grep -r 'index \\".* table \\"' --incl='*.c'
src/backend/catalog/index.c: (errmsg("building index \"%s\" on table \"%s\" serially",
src/backend/catalog/index.c: (errmsg_plural("building index \"%s\" on table \"%s\" with request for %d parallel worker",
src/backend/catalog/index.c: "building index \"%s\" on table \"%s\" with request for %d parallel workers",
src/backend/catalog/catalog.c: errmsg("index \"%s\" does not belong to table \"%s\"",
src/backend/commands/indexcmds.c: (errmsg("%s %s will create implicit index \"%s\" for table \"%s\"",
src/backend/commands/tablecmds.c: errmsg("index \"%s\" for table \"%s\" does not exist",
src/backend/commands/tablecmds.c: errmsg("index \"%s\" for table \"%s\" does not exist",
src/backend/commands/tablecmds.c: errdetail("The index \"%s\" belongs to a constraint in table \"%s\" but no constraint exists for index \"%s\".",
src/backend/commands/cluster.c: errmsg("index \"%s\" for table \"%s\" does not exist",
src/backend/parser/parse_utilcmd.c: errmsg("index \"%s\" does not belong to table \"%s\"",

Attachment Content-Type Size
v14-0001-make-vacrelstats-a-global.patch text/x-diff 33.5 KB
v14-0002-vacuum-errcontext-to-show-block-being-processed.patch text/x-diff 6.7 KB
v14-0003-Avoid-extra-calls-like-GetRelationName.patch text/x-diff 7.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-01-27 06:01:08 Re: Setting min/max TLS protocol in clientside libpq
Previous Message Kasahara Tatsuhito 2020-01-27 05:35:03 Tid scan increments value of pg_stat_all_tables.seq_scan. (but not seq_tup_read)