Re: pg_upgrade should truncate/remove its logs before running

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Daniel Gustafsson <daniel@yesql.se>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Andrew Dunstan <andrew@dunslane.net>, Bruce Momjian <bruce@momjian.us>, pgsql-hackers@lists.postgresql.org
Date: 2022-01-12T03:59:54Z
Lists: pgsql-hackers
On Tue, Jan 11, 2022 at 02:03:07PM -0600, Justin Pryzby wrote:
> I added mkdir() before the other stuff that messes with logfiles, because it
> needs to happen before that.
> 
> Are you suggesting to change the pre-existing behavior of when logfiles are
> created, like 0002 ?

Yes, something like that.

> There's no reason not to.  We created the dir, and the user didn't specify to
> preserve it.  It'd be their fault if they put something valuable there after
> starting pg_upgrade.

This is a path for the data internal to pg_upgrade.  My take is that
the code simplifications the new option brings are more valuable than
this assumption, which I guess would unlikely happen.  I may be wrong,
of course.  By the way, while thinking about that, should we worry
about --logdir="."?
--
Michael

Commits

  1. pg_upgrade: Move all the files generated internally to a subdirectory