mirror of
https://github.com/postgres/postgres.git
synced 2025-07-21 16:02:15 +03:00
On Windows, have pg_upgrade use different two files to log pg_ctl
start/stop output, to fix file share error reported by Edmund Horner
This commit is contained in:
@ -58,8 +58,8 @@ OSInfo os_info;
|
|||||||
char *output_files[] = {
|
char *output_files[] = {
|
||||||
SERVER_LOG_FILE,
|
SERVER_LOG_FILE,
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
/* file is unique on Win32 */
|
SERVER_START_LOG_FILE,
|
||||||
SERVER_LOG_FILE2,
|
SERVER_STOP_LOG_FILE,
|
||||||
#endif
|
#endif
|
||||||
RESTORE_LOG_FILE,
|
RESTORE_LOG_FILE,
|
||||||
UTILITY_LOG_FILE,
|
UTILITY_LOG_FILE,
|
||||||
|
@ -50,8 +50,8 @@ extern char *output_files[];
|
|||||||
* because it is being used by another process." so send the pg_ctl
|
* 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.
|
* 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
|
* 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
|
* keep the pg_ctl output file open by the running postmaster, even after
|
||||||
* running postmaster.
|
* pg_ctl exits.
|
||||||
*
|
*
|
||||||
* We could use the Windows pgwin32_open() flags to allow shared file
|
* 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
|
* writes but is unclear how all other tools would use those flags, so
|
||||||
@ -59,9 +59,11 @@ extern char *output_files[];
|
|||||||
* the error message appropriately.
|
* the error message appropriately.
|
||||||
*/
|
*/
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#define SERVER_LOG_FILE2 SERVER_LOG_FILE
|
#define SERVER_START_LOG_FILE SERVER_LOG_FILE
|
||||||
|
#define SERVER_STOP_LOG_FILE SERVER_LOG_FILE
|
||||||
#else
|
#else
|
||||||
#define SERVER_LOG_FILE2 "pg_upgrade_server2.log"
|
#define SERVER_START_LOG_FILE "pg_upgrade_server_start.log"
|
||||||
|
#define SERVER_STOP_LOG_FILE "pg_upgrade_server_stop.log"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ start_postmaster(ClusterInfo *cluster)
|
|||||||
(cluster->controldata.cat_ver >=
|
(cluster->controldata.cat_ver >=
|
||||||
BINARY_UPGRADE_SERVER_FLAG_CAT_VER) ? "-b" :
|
BINARY_UPGRADE_SERVER_FLAG_CAT_VER) ? "-b" :
|
||||||
"-c autovacuum=off -c autovacuum_freeze_max_age=2000000000",
|
"-c autovacuum=off -c autovacuum_freeze_max_age=2000000000",
|
||||||
cluster->pgopts ? cluster->pgopts : "", SERVER_LOG_FILE2);
|
cluster->pgopts ? cluster->pgopts : "", SERVER_START_LOG_FILE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Don't throw an error right away, let connecting throw the error because
|
* Don't throw an error right away, let connecting throw the error because
|
||||||
@ -173,9 +173,9 @@ start_postmaster(ClusterInfo *cluster)
|
|||||||
*/
|
*/
|
||||||
pg_ctl_return = exec_prog(false, true,
|
pg_ctl_return = exec_prog(false, true,
|
||||||
/* pass both file names if the differ */
|
/* pass both file names if the differ */
|
||||||
(strcmp(SERVER_LOG_FILE, SERVER_LOG_FILE2) == 0) ?
|
(strcmp(SERVER_LOG_FILE, SERVER_START_LOG_FILE) == 0) ?
|
||||||
SERVER_LOG_FILE :
|
SERVER_LOG_FILE :
|
||||||
SERVER_LOG_FILE " or " SERVER_LOG_FILE2,
|
SERVER_LOG_FILE " or " SERVER_START_LOG_FILE,
|
||||||
"%s", cmd);
|
"%s", cmd);
|
||||||
|
|
||||||
/* Check to see if we can connect to the server; if not, report it. */
|
/* Check to see if we can connect to the server; if not, report it. */
|
||||||
@ -214,13 +214,13 @@ stop_postmaster(bool fast)
|
|||||||
return; /* no cluster running */
|
return; /* no cluster running */
|
||||||
|
|
||||||
snprintf(cmd, sizeof(cmd),
|
snprintf(cmd, sizeof(cmd),
|
||||||
SYSTEMQUOTE "\"%s/pg_ctl\" -w -l \"%s\" -D \"%s\" -o \"%s\" "
|
SYSTEMQUOTE "\"%s/pg_ctl\" -w -D \"%s\" -o \"%s\" "
|
||||||
"%s stop >> \"%s\" 2>&1" SYSTEMQUOTE,
|
"%s stop >> \"%s\" 2>&1" SYSTEMQUOTE,
|
||||||
cluster->bindir, SERVER_LOG_FILE2, cluster->pgconfig,
|
cluster->bindir, cluster->pgconfig,
|
||||||
cluster->pgopts ? cluster->pgopts : "",
|
cluster->pgopts ? cluster->pgopts : "",
|
||||||
fast ? "-m fast" : "", SERVER_LOG_FILE2);
|
fast ? "-m fast" : "", SERVER_STOP_LOG_FILE);
|
||||||
|
|
||||||
exec_prog(fast ? false : true, true, SERVER_LOG_FILE2, "%s", cmd);
|
exec_prog(fast ? false : true, true, SERVER_STOP_LOG_FILE, "%s", cmd);
|
||||||
|
|
||||||
os_info.running_cluster = NULL;
|
os_info.running_cluster = NULL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user