Re: 9.2 pg_upgrade regression tests on WIndows

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 9.2 pg_upgrade regression tests on WIndows
Date: 2012-09-06 02:45:48
Message-ID: 20120906024548.GA9302@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 5, 2012 at 10:35:26PM -0400, Andrew Dunstan wrote:
> diff --git a/contrib/pg_upgrade/exec.c b/contrib/pg_upgrade/exec.c
> index 99f5006..f84d857 100644
> --- a/contrib/pg_upgrade/exec.c
> +++ b/contrib/pg_upgrade/exec.c
> @@ -63,7 +63,25 @@ exec_prog(const char *log_file, const char *opt_log_file,
> if (written >= MAXCMDLEN)
> pg_log(PG_FATAL, "command too long\n");
>
> - if ((log = fopen_priv(log_file, "a")) == NULL)
> +#ifdef WIN32
> + {
> + /*
> + * Try to open the log file a few times in case the
> + * server takes a bit longer than we'd like to release it.
> + */
> + int iter;
> + for (iter = 0; iter < 5; iter++)
> + {
> + log = fopen_priv(log_file, "a");
> + if (log != NULL || iter == 4)
> + break;
> + sleep(1);
> + }
> + }
> +#else
> + log = fopen_priv(log_file, "a");
> +#endif
> + if (log == NULL)
> pg_log(PG_FATAL, "cannot write to log file %s\n", log_file);
> #ifdef WIN32
> fprintf(log, "\n\n");

Oh, also, we normally put the ifndef WIN32 code first because that is
our most common platform. Also, is "|| iter == 4" necessary?

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

+ It's impossible for everything to be true. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2012-09-06 02:46:17 Re: 9.2 pg_upgrade regression tests on WIndows
Previous Message Bruce Momjian 2012-09-06 02:41:08 Re: 9.2 pg_upgrade regression tests on WIndows