pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: Edmund Horner <ejrh00@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: PostgreSQL 9.2 beta1's pg_upgrade fails on Windows XP
Date: Thu, 24 May 2012 20:34:01 -0400
Message-ID: <20120525003401.GA25460@momjian.us> (raw)
In-Reply-To: <CAMyN-kBUzHrkHK77cCAU=VQvv7tT-ekXO+JJZTTBscNrzEct1g@mail.gmail.com>
References: <CAMyN-kD76ptQ8pMDGw7ci_fLPUx-Z03gAdALX8dTvTdQ7GurEA@mail.gmail.com>
	<4FBB36F2.6060601@ringerc.id.au>
	<CAMyN-kCd+h2GJJcF9EedUHCJxExq2HhFLu=dgGHY4a74OmfDew@mail.gmail.com>
	<CABUevEwF=3D7GxnPqh+K8qMsHNtVp9OS7Z5LQdm+JYR-Ystpaw@mail.gmail.com>
	<20120524003302.GF10306@momjian.us>
	<CAMyN-kAFE_BXobh_aYcCsgPPMgcKQ3UfosTqqkJWro2wvqLWJg@mail.gmail.com>
	<CABUevEx5Y_CnktejAjLEC5B0i0xAdAKdoQH9nhrzSHECLRPeyA@mail.gmail.com>
	<20120524135956.GH10306@momjian.us>
	<CAMyN-kBUzHrkHK77cCAU=VQvv7tT-ekXO+JJZTTBscNrzEct1g@mail.gmail.com>

On Fri, May 25, 2012 at 11:48:53AM +1200, Edmund Horner wrote:
> It still fails (when run in verbose mode):
> 
>     Creating catalog dump
> ""c:\ehorner\pgsql\bin/pg_dumpall" --port 50432 --username "ehorner"
> --schema-only --binary-upgrade --verbose > "pg_upgrade_dump_all.sql"
> 2>> "pg_upgrade_utility.log""
>     ok
>     ""c:\ehorner\pgsql-old\bin/pg_ctl" -w -l "pg_upgrade_server2.log"
> -D "c:\ehorner\pgdata-old" -o""  stop >> "pg_upgrade_server2.log"
> 2>&1"
>     The process cannot access the file because it is being used by
> another process.
>     *failure*
>     There were problems executing """c:\ehorner\pgsql-old\bin/pg_ctl"
> -w -l "pg_upgrade_server2.log" -D "c:\ehorner\pgdata-old" -o ""  stop
> >> "pg_upgrade_server2.log" 2>&1""

Bingo, this is exactly where I expected it to fail.   I am attaching a
new, applied patch that creates files pg_upgrade_server_start.log and
pg_upgrade_server_stop.log to log the pg_ctl start/stop stdout
seperately.  This should fix the error.  Thanks so much for testing.  I
believe someone will generate a new binary for testing.

> I.e. I think pg_ctl wrote the last couple of lines, and then the two
> cmd.exe were unable to write anything more since presumably it's still
> open.
> 
> So is this the problem you predicted above with pg_ctl stop?

Yep, I think we are good now.  I never expected this behavior, but it
now makes sense.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

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

Attachments:

pg_upgrade.diff (text/x-diff, 4.9K) download diff --git a/contrib/pg_upgrade/pg_upgrade.c b/contrib/pg_upgrade/pg_upgrade.c new file mode 100644 index 7297efd..3df3836 *** a/contrib/pg_upgrade/pg_upgrade.c --- b/contrib/pg_upgrade/pg_upgrade.c *************** OSInfo os_info; *** 58,65 **** char *output_files[] = { SERVER_LOG_FILE, #ifdef WIN32 ! /* file is unique on Win32 */ ! SERVER_LOG_FILE2, #endif RESTORE_LOG_FILE, UTILITY_LOG_FILE, --- 58,65 ---- char *output_files[] = { SERVER_LOG_FILE, #ifdef WIN32 ! SERVER_START_LOG_FILE, ! SERVER_STOP_LOG_FILE, #endif RESTORE_LOG_FILE, UTILITY_LOG_FILE, diff --git a/contrib/pg_upgrade/pg_upgrade.h b/contrib/pg_upgrade/pg_upgrade.h new file mode 100644 index 0d6269a..5891997 *** a/contrib/pg_upgrade/pg_upgrade.h --- b/contrib/pg_upgrade/pg_upgrade.h *************** extern char *output_files[]; *** 50,57 **** * because it is being used by another process." so send the pg_ctl * command-line output to a new file, rather than into the server log file. * Ideally we could use UTILITY_LOG_FILE for this, but some Windows platforms ! * keep the pg_ctl output file open even after pg_ctl exits, perhaps by the ! * running postmaster. * * We could use the Windows pgwin32_open() flags to allow shared file * writes but is unclear how all other tools would use those flags, so --- 50,57 ---- * because it is being used by another process." so send the pg_ctl * command-line output to a new file, rather than into the server log file. * Ideally we could use UTILITY_LOG_FILE for this, but some Windows platforms ! * keep the pg_ctl output file open by the running postmaster, even after ! * pg_ctl exits. * * We could use the Windows pgwin32_open() flags to allow shared file * writes but is unclear how all other tools would use those flags, so *************** extern char *output_files[]; *** 59,67 **** * the error message appropriately. */ #ifndef WIN32 ! #define SERVER_LOG_FILE2 SERVER_LOG_FILE #else ! #define SERVER_LOG_FILE2 "pg_upgrade_server2.log" #endif --- 59,69 ---- * the error message appropriately. */ #ifndef WIN32 ! #define SERVER_START_LOG_FILE SERVER_LOG_FILE ! #define SERVER_STOP_LOG_FILE SERVER_LOG_FILE #else ! #define SERVER_START_LOG_FILE "pg_upgrade_server_start.log" ! #define SERVER_STOP_LOG_FILE "pg_upgrade_server_stop.log" #endif diff --git a/contrib/pg_upgrade/server.c b/contrib/pg_upgrade/server.c new file mode 100644 index b515e05..f557453 *** a/contrib/pg_upgrade/server.c --- b/contrib/pg_upgrade/server.c *************** start_postmaster(ClusterInfo *cluster) *** 165,171 **** (cluster->controldata.cat_ver >= BINARY_UPGRADE_SERVER_FLAG_CAT_VER) ? "-b" : "-c autovacuum=off -c autovacuum_freeze_max_age=2000000000", ! cluster->pgopts ? cluster->pgopts : "", SERVER_LOG_FILE2); /* * Don't throw an error right away, let connecting throw the error because --- 165,171 ---- (cluster->controldata.cat_ver >= BINARY_UPGRADE_SERVER_FLAG_CAT_VER) ? "-b" : "-c autovacuum=off -c autovacuum_freeze_max_age=2000000000", ! cluster->pgopts ? cluster->pgopts : "", SERVER_START_LOG_FILE); /* * Don't throw an error right away, let connecting throw the error because *************** start_postmaster(ClusterInfo *cluster) *** 173,181 **** */ pg_ctl_return = exec_prog(false, true, /* pass both file names if the differ */ ! (strcmp(SERVER_LOG_FILE, SERVER_LOG_FILE2) == 0) ? SERVER_LOG_FILE : ! SERVER_LOG_FILE " or " SERVER_LOG_FILE2, "%s", cmd); /* Check to see if we can connect to the server; if not, report it. */ --- 173,181 ---- */ pg_ctl_return = exec_prog(false, true, /* pass both file names if the differ */ ! (strcmp(SERVER_LOG_FILE, SERVER_START_LOG_FILE) == 0) ? SERVER_LOG_FILE : ! SERVER_LOG_FILE " or " SERVER_START_LOG_FILE, "%s", cmd); /* Check to see if we can connect to the server; if not, report it. */ *************** stop_postmaster(bool fast) *** 214,226 **** return; /* no cluster running */ snprintf(cmd, sizeof(cmd), ! SYSTEMQUOTE "\"%s/pg_ctl\" -w -l \"%s\" -D \"%s\" -o \"%s\" " "%s stop >> \"%s\" 2>&1" SYSTEMQUOTE, ! cluster->bindir, SERVER_LOG_FILE2, cluster->pgconfig, cluster->pgopts ? cluster->pgopts : "", ! fast ? "-m fast" : "", SERVER_LOG_FILE2); ! exec_prog(fast ? false : true, true, SERVER_LOG_FILE2, "%s", cmd); os_info.running_cluster = NULL; } --- 214,226 ---- return; /* no cluster running */ snprintf(cmd, sizeof(cmd), ! SYSTEMQUOTE "\"%s/pg_ctl\" -w -D \"%s\" -o \"%s\" " "%s stop >> \"%s\" 2>&1" SYSTEMQUOTE, ! cluster->bindir, cluster->pgconfig, cluster->pgopts ? cluster->pgopts : "", ! fast ? "-m fast" : "", SERVER_STOP_LOG_FILE); ! exec_prog(fast ? false : true, true, SERVER_STOP_LOG_FILE, "%s", cmd); os_info.running_cluster = NULL; }

view thread (17+ messages)  latest in thread

Message-ID: <20120525003401.GA25460@momjian.us>
Permalink:  ../20120525003401.GA25460@momjian.us/
Also on:    postgresql.org/message-id/20120525003401.GA25460@momjian.us

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: bruce@momjian.us, ejrh00@gmail.com
  Subject: Re: PostgreSQL 9.2 beta1's pg_upgrade fails on Windows XP
  In-Reply-To: <20120525003401.GA25460@momjian.us>
  References: <CAMyN-kD76ptQ8pMDGw7ci_fLPUx-Z03gAdALX8dTvTdQ7GurEA@mail.gmail.com> <4FBB36F2.6060601@ringerc.id.au> <CAMyN-kCd+h2GJJcF9EedUHCJxExq2HhFLu=dgGHY4a74OmfDew@mail.gmail.com> <CABUevEwF=3D7GxnPqh+K8qMsHNtVp9OS7Z5LQdm+JYR-Ystpaw@mail.gmail.com> <20120524003302.GF10306@momjian.us> <CAMyN-kAFE_BXobh_aYcCsgPPMgcKQ3UfosTqqkJWro2wvqLWJg@mail.gmail.com> <CABUevEx5Y_CnktejAjLEC5B0i0xAdAKdoQH9nhrzSHECLRPeyA@mail.gmail.com> <20120524135956.GH10306@momjian.us> <CAMyN-kBUzHrkHK77cCAU=VQvv7tT-ekXO+JJZTTBscNrzEct1g@mail.gmail.com> <20120525003401.GA25460@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox