Search Postgresql Archives

Re: Testing 9.0beta3 and pg_upgrade

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thomas Kellerer wrote:
> Checking new data directory (c:/etc/Postgres9.0-beta3/datadir)ok
> ""c:/Program Files/PostgreSQL/8.4/bin/pg_ctl" -l "migrate.log" -D
> "c:/Daten/db/pgdata84" -o "-p 5432 -c autovacuum=off -c
> autovacuum_freeze_max_age=20 00000000" start >> "nul" 2>&1" Trying to
> start old server                                  ...........
>   Unable to start old postmaster with the command: ""c:/Program
>   Files/PostgreSQL/8.4/bin/pg_ctl" -l "migrate.log" -D
>   "c:/Daten/db/pgdata84" -o "-p 5432 -c autovacuum=off -c
>   autovacuum_freeze_max_age=2000000000" start >> "nul" 2>&1" Perhaps
> pg_hba.conf was not set to "trust".
> 
> Now when I manually copy and paste the logged command, the server starts
> up fine and I can verify with ProcessExplorer that pg_upgrade indeed
> does not spawn a postgres.exe (or pg_ctl.exe)
> 
> As I have done one successful migration already, and the only difference
> was the logfile, I removed the --logfile switch from the batch file
> and then pg_upgrade ran without problems.
> 
> In the commandline starting the old server -l "migrate.log" is replaced
> with -l "nul"

> I _think_ the reason for this is that pg_upgrade locks migrate.log and
> then postgres.exe cannot write to the file and thus fails to start.
> When I manually run the command, pg_upgrade is not locking migrate.log
> and therefor the server starts (and thus the confusion that the same
> command works from the commandline but not when pg_upgrade runs it)

Your diagnosis is correct.  I thought we had fixed this by having pg_ctl
output go to NUL, but it turns out even server logs can't go to nul
either if we are already logging to that file.  Attached patch removes
logging of pg_ctl and server output on win32.


> P.S.: pg_upgrade --help says: "Report bugs to
> <pg-migrator-general@xxxxxxxxxxxxxxxxxxx>" Shouldn't that be changed
> as well?

Oops, fixed as well.  Thanks.

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

  + None of us is going to be here forever. +
Index: contrib/pg_upgrade/server.c
===================================================================
RCS file: /cvsroot/pgsql/contrib/pg_upgrade/server.c,v
retrieving revision 1.8
diff -c -c -r1.8 server.c
*** contrib/pg_upgrade/server.c	6 Jul 2010 19:18:55 -0000	1.8
--- contrib/pg_upgrade/server.c	13 Jul 2010 20:00:41 -0000
***************
*** 181,189 ****
  	}
  
  	/*
! 	 * On Win32, we can't send both server output and pg_ctl output to the
  	 * same file because we get the error: "The process cannot access the file
! 	 * because it is being used by another process." so we have to send pg_ctl
  	 * output to 'nul'.
  	 */
  	snprintf(cmd, sizeof(cmd),
--- 181,189 ----
  	}
  
  	/*
! 	 * On Win32, we can't send both pg_upgrade output and pg_ctl output to the
  	 * same file because we get the error: "The process cannot access the file
! 	 * because it is being used by another process." so we have to send all other
  	 * output to 'nul'.
  	 */
  	snprintf(cmd, sizeof(cmd),
***************
*** 191,201 ****
  			 "-o \"-p %d -c autovacuum=off "
  			 "-c autovacuum_freeze_max_age=2000000000\" "
  			 "start >> \"%s\" 2>&1" SYSTEMQUOTE,
! 			 bindir, ctx->logfile, datadir, port,
  #ifndef WIN32
! 			 ctx->logfile);
  #else
! 			 DEVNULL);
  #endif
  	exec_prog(ctx, true, "%s", cmd);
  
--- 191,201 ----
  			 "-o \"-p %d -c autovacuum=off "
  			 "-c autovacuum_freeze_max_age=2000000000\" "
  			 "start >> \"%s\" 2>&1" SYSTEMQUOTE,
! 			 bindir,
  #ifndef WIN32
! 			 ctx->logfile, datadir, port, ctx->logfile);
  #else
! 			 DEVNULL, datadir, port, DEVNULL);
  #endif
  	exec_prog(ctx, true, "%s", cmd);
  
***************
*** 235,245 ****
  	snprintf(cmd, sizeof(cmd),
  			 SYSTEMQUOTE "\"%s/pg_ctl\" -l \"%s\" -D \"%s\" %s stop >> "
  			 "\"%s\" 2>&1" SYSTEMQUOTE,
! 			 bindir, ctx->logfile, datadir, fast ? "-m fast" : "",
  #ifndef WIN32
! 			 ctx->logfile);
  #else
! 			 DEVNULL);
  #endif
  	exec_prog(ctx, fast ? false : true, "%s", cmd);
  
--- 235,245 ----
  	snprintf(cmd, sizeof(cmd),
  			 SYSTEMQUOTE "\"%s/pg_ctl\" -l \"%s\" -D \"%s\" %s stop >> "
  			 "\"%s\" 2>&1" SYSTEMQUOTE,
! 			 bindir,
  #ifndef WIN32
! 			 ctx->logfile, datadir, fast ? "-m fast" : "", ctx->logfile);
  #else
! 			 DEVNULL, datadir, fast ? "-m fast" : "", DEVNULL);
  #endif
  	exec_prog(ctx, fast ? false : true, "%s", cmd);
  
Index: contrib/pg_upgrade/server.c
===================================================================
RCS file: /cvsroot/pgsql/contrib/pg_upgrade/server.c,v
retrieving revision 1.8
diff -c -c -r1.8 server.c
*** contrib/pg_upgrade/server.c	6 Jul 2010 19:18:55 -0000	1.8
--- contrib/pg_upgrade/server.c	13 Jul 2010 20:00:41 -0000
***************
*** 181,189 ****
  	}
  
  	/*
! 	 * On Win32, we can't send both server output and pg_ctl output to the
  	 * same file because we get the error: "The process cannot access the file
! 	 * because it is being used by another process." so we have to send pg_ctl
  	 * output to 'nul'.
  	 */
  	snprintf(cmd, sizeof(cmd),
--- 181,189 ----
  	}
  
  	/*
! 	 * On Win32, we can't send both pg_upgrade output and pg_ctl output to the
  	 * same file because we get the error: "The process cannot access the file
! 	 * because it is being used by another process." so we have to send all other
  	 * output to 'nul'.
  	 */
  	snprintf(cmd, sizeof(cmd),
***************
*** 191,201 ****
  			 "-o \"-p %d -c autovacuum=off "
  			 "-c autovacuum_freeze_max_age=2000000000\" "
  			 "start >> \"%s\" 2>&1" SYSTEMQUOTE,
! 			 bindir, ctx->logfile, datadir, port,
  #ifndef WIN32
! 			 ctx->logfile);
  #else
! 			 DEVNULL);
  #endif
  	exec_prog(ctx, true, "%s", cmd);
  
--- 191,201 ----
  			 "-o \"-p %d -c autovacuum=off "
  			 "-c autovacuum_freeze_max_age=2000000000\" "
  			 "start >> \"%s\" 2>&1" SYSTEMQUOTE,
! 			 bindir,
  #ifndef WIN32
! 			 ctx->logfile, datadir, port, ctx->logfile);
  #else
! 			 DEVNULL, datadir, port, DEVNULL);
  #endif
  	exec_prog(ctx, true, "%s", cmd);
  
***************
*** 235,245 ****
  	snprintf(cmd, sizeof(cmd),
  			 SYSTEMQUOTE "\"%s/pg_ctl\" -l \"%s\" -D \"%s\" %s stop >> "
  			 "\"%s\" 2>&1" SYSTEMQUOTE,
! 			 bindir, ctx->logfile, datadir, fast ? "-m fast" : "",
  #ifndef WIN32
! 			 ctx->logfile);
  #else
! 			 DEVNULL);
  #endif
  	exec_prog(ctx, fast ? false : true, "%s", cmd);
  
--- 235,245 ----
  	snprintf(cmd, sizeof(cmd),
  			 SYSTEMQUOTE "\"%s/pg_ctl\" -l \"%s\" -D \"%s\" %s stop >> "
  			 "\"%s\" 2>&1" SYSTEMQUOTE,
! 			 bindir,
  #ifndef WIN32
! 			 ctx->logfile, datadir, fast ? "-m fast" : "", ctx->logfile);
  #else
! 			 DEVNULL, datadir, fast ? "-m fast" : "", DEVNULL);
  #endif
  	exec_prog(ctx, fast ? false : true, "%s", cmd);
  
-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux