Re: pg_upgrade should truncate/remove its logs before running

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pg_upgrade should truncate/remove its logs before running
Date: 2021-12-15 21:09:16
Message-ID: 20211215210916.GC4440@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

If only the physical world exists, free will is an illusion.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-12-15 21:10:04 Re: Buildfarm support for older versions
Previous Message Peter Geoghegan 2021-12-15 20:26:47 Re: Removing more vacuumlazy.c special cases, relfrozenxid optimizations