Re: display offset along with block number in vacuum errors

Justin Pryzby <pryzby@telsasoft.com>

From: Justin Pryzby <pryzby@telsasoft.com>
To: Mahendra Singh Thalor <mahi6run@gmail.com>
Cc: pgsql-hackers@postgresql.org, Masahiko Sawada <masahiko.sawada@2ndquadrant.com>
Date: 2020-08-01T13:49:10Z
Lists: pgsql-hackers
On Sat, Aug 01, 2020 at 12:31:53PM +0530, Mahendra Singh Thalor wrote:
> Actually I was waiting for review comments from committer and other
> people also and was planning to send a patch after that. I already
> fixed your comments in my offline patch and was waiting for more
> comments. Anyway, thanks for delta patch.
> 
> Here, attaching v3 patch for review.

I wasn't being impatient but I spent enough time thinking about this that it
made sense to put it in patch form.  Your patch has a couple extaneous changes:

                case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
                        if (BlockNumberIsValid(errinfo->blkno))
+                       {
                                errcontext("while vacuuming block %u of relation \"%s.%s\"",
                                                   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+                       }
                        break;
 
                case VACUUM_ERRCB_PHASE_VACUUM_INDEX:
@@ -3589,6 +3618,7 @@ vacuum_error_callback(void *arg)
                                           errinfo->indname, errinfo->relnamespace, errinfo->relname);
                        break;
 
+
                case VACUUM_ERRCB_PHASE_INDEX_CLEANUP:
                        errcontext("while cleaning up index \"%s\" of relation \"%s.%s\"",

I would get rid of these by doing like: git reset -p HEAD~1 (say "n" to most
hunks and "y" to reset just the two, above), then git commit --amend (without
-a and without pathnames), then git diff will show local changes (including
those no-longer-committed hunks), which you can git checkout -p (or similar).
I'd be interested to hear if there's a better way.

-- 
Justin



Commits

  1. Add additional information in the vacuum error context.

  2. Improve the vacuum error context phase information.

  3. Introduce vacuum errcontext to display additional information.