Re: [v15 beta] pg_upgrade failed if earlier executed with -c switch

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, tushar <tushar(dot)ahuja(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: [v15 beta] pg_upgrade failed if earlier executed with -c switch
Date: 2022-06-05 09:19:33
Message-ID: Ypx1JTdupnDYjF+T@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jun 05, 2022 at 09:24:25AM +0900, Michael Paquier wrote:
> Well, another error that could happen in the early code paths is
> EACCES on a custom socket directory specified, and we'd still face the
> same problem on a follow-up restart. Using a sub-directory structure
> as Daniel and Tom mention would address all that (if ignoring EEXIST
> for the BASE_OUTPUTDIR), removing any existing content from the base
> path when not using --retain. This comes with the disadvantage of
> bloating the disk on repeated errors, but this last bit would not
> really be a huge problem, I guess, as it could be more useful to keep
> the error information around.

I have been toying with the idea of a sub-directory named with a
timestamp (Unix time, like log_line_prefix's %n but this could be
any format) under pg_upgrade_output.d/ and finished with the
attached. The logs are removed from the root path when --check is
used without --retain, like for a non-check command. I have added a
set of tests to provide some coverage for the whole:
- Failure of --check where the binary path does not exist, and
pg_upgrade_output.d/ is not removed.
- Follow-up run of pg_upgrade --check, where pg_upgrade_output.d/ is
removed.
- Check that pg_upgrade_output.d/ is also removed after the main
upgrade command completes.

The logic in charge of cleaning up the logs has been moved to a single
routine, aka cleanup_logs().

Thoughts?
--
Michael

Attachment Content-Type Size
upgrade-check-logs-v2.patch text/x-diff 7.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2022-06-05 09:51:32 Re: pgcon unconference / impact of block size on performance
Previous Message Guillaume Lelarge 2022-06-05 07:03:47 Re: Proposal: adding a better description in psql command about large objects