Re: pg_upgrade should truncate/remove its logs before running
Justin Pryzby <pryzby@telsasoft.com>
From: Justin Pryzby <pryzby@telsasoft.com>
To: Daniel Gustafsson <daniel@yesql.se>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Michael Paquier <michael@paquier.xyz>, Andrew Dunstan <andrew@dunslane.net>, Bruce Momjian <bruce@momjian.us>, Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers@lists.postgresql.org
Date: 2021-12-17T17:21:13Z
Lists: pgsql-hackers
Attachments
- 0001-pg_upgrade-write-logfiles-and-dumps-in-subdir.patch (text/x-diff)
On Thu, Dec 16, 2021 at 12:23:08PM +0100, Daniel Gustafsson wrote: > > On 16 Dec 2021, at 12:11, Peter Eisentraut <peter.eisentraut@enterprisedb.com> wrote: > > > Could we make it write just one log file? Is having multiple log files better? > > Having individual <checkname>.txt files from checks with additional information > on how to handle the error are quite convenient when writing wrappers around > pg_upgrade (speaking from experience of having written multiple pg_upgraade > frontends). Parsing a single logfile is more work, and will break existing > scripts. > > I'm in favor of a predictable by default logpath, with a parameter to override, > as mentioned upthread. I put this together in the simplest way, prefixing all the filenames with the configured path.. Another options is to chdir() into the given path. But, pg_upgrade takes (and requires) a bunch of other paths, like -d -D -b -B, and those are traditionally interpretted relative to CWD. I could getcwd() and prefix all the -[dDbB] with that, but prefixing a handful of binary/data paths is hardly better than prefixing a handful of dump/logfile paths. I suppose that openat() isn't portable. I don't think this it's worth prohibiting relative paths, so I can't think of any less-naive way to do this. I didn't move the delete-old-cluster.sh, since that's intended to stay around even after a successful upgrade, as opposed to the other logs, which are typically removed at that point. -- Justin
Commits
-
pg_upgrade: Move all the files generated internally to a subdirectory
- 38bfae365266 15.0 landed