pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Pryzby <pryzby@telsasoft.com>
To: Bruce Momjian <bruce@momjian.us>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: pg_upgrade should truncate/remove its logs before running
Date: Wed, 15 Dec 2021 15:12:12 -0600
Message-ID: <20211215211212.GT17618@telsasoft.com> (raw)
In-Reply-To: <20211215210916.GC4440@momjian.us>
References: <20211212025017.GN17618@telsasoft.com>
	<20211215210916.GC4440@momjian.us>

On Wed, Dec 15, 2021 at 04:09:16PM -0500, Bruce Momjian wrote:
> On Sat, Dec 11, 2021 at 08:50:17PM -0600, Justin Pryzby wrote:
> > I have seen this numerous times but had not dug into it, until now.
> > 
> > If pg_upgrade fails and is re-run, it appends to its logfiles, which is
> > confusing since, if it fails again, it then looks like the original error
> > recurred and wasn't fixed.  The "append" behavior dates back to 717f6d608.
> > 
> > I think it should either truncate the logfiles, or error early if any of the
> > files exist.  Or it could put all its output files into a newly-created
> > subdirectory.  Or this message could be output to the per-db logfiles, and not
> > just the static ones:
> > | "pg_upgrade run on %s".
> > 
> > For the per-db logfiels with OIDs in their name, changing open() from "append"
> > mode to truncate mode doesn't work, since they're written to in parallel.
> > They have to be removed/truncated in advance.
> > 
> > This is one possible fix.  You can test its effect by deliberately breaking one
> > of the calls to exec_progs(), like this.
> > 
> > -  "\"%s/pg_restore\" %s %s --exit-on-error --verbose "
> > +  "\"%s/pg_restore\" %s %s --exit-on-error --verboose "
> 
> Uh, the database server doesn't erase its logs on crash/failure, so why
> should pg_upgrade do that?

To avoid the presence of irrelevant errors from the previous invocation of
pg_upgrade.

Maybe you would prefer one of my other ideas , like "put all its output files
into a newly-created subdirectory" ?

-- 
Justin





view thread (53+ messages)  latest in thread

Message-ID: <20211215211212.GT17618@telsasoft.com>
Permalink:  ../20211215211212.GT17618@telsasoft.com/
Also on:    postgresql.org/message-id/20211215211212.GT17618@telsasoft.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: pryzby@telsasoft.com, bruce@momjian.us, pgsql-hackers@lists.postgresql.org
  Subject: Re: pg_upgrade should truncate/remove its logs before running
  In-Reply-To: <20211215211212.GT17618@telsasoft.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox