mirror of
https://github.com/postgres/postgres.git
synced 2025-04-25 21:42:33 +03:00
In pg_upgrade, document why we can't issue \n\n in the command logfile
on Windows. Slightly cleanup log output on Windows given this restriction. Backpatch to 9.2.
This commit is contained in:
parent
c4c227477b
commit
022cd22f0f
@ -63,8 +63,11 @@ exec_prog(const char *log_file, const char *opt_log_file,
|
|||||||
if (written >= MAXCMDLEN)
|
if (written >= MAXCMDLEN)
|
||||||
pg_log(PG_FATAL, "command too long\n");
|
pg_log(PG_FATAL, "command too long\n");
|
||||||
|
|
||||||
if ((log = fopen_priv(log_file, "a+")) == NULL)
|
if ((log = fopen_priv(log_file, "a")) == NULL)
|
||||||
pg_log(PG_FATAL, "cannot write to log file %s\n", log_file);
|
pg_log(PG_FATAL, "cannot write to log file %s\n", log_file);
|
||||||
|
#ifdef WIN32
|
||||||
|
fprintf(log, "\n\n");
|
||||||
|
#endif
|
||||||
pg_log(PG_VERBOSE, "%s\n", cmd);
|
pg_log(PG_VERBOSE, "%s\n", cmd);
|
||||||
fprintf(log, "command: %s\n", cmd);
|
fprintf(log, "command: %s\n", cmd);
|
||||||
|
|
||||||
@ -97,10 +100,13 @@ exec_prog(const char *log_file, const char *opt_log_file,
|
|||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
/*
|
/*
|
||||||
* Can't do this on Windows, postmaster will still hold the log file
|
* We can't do this on Windows because it will keep the "pg_ctl start"
|
||||||
* open if the command was "pg_ctl start".
|
* output filename open until the server stops, so we do the \n\n above
|
||||||
|
* on that platform. We use a unique filename for "pg_ctl start" that is
|
||||||
|
* never reused while the server is running, so it works fine. We could
|
||||||
|
* log these commands to a third file, but that just adds complexity.
|
||||||
*/
|
*/
|
||||||
if ((log = fopen_priv(log_file, "a+")) == NULL)
|
if ((log = fopen_priv(log_file, "a")) == NULL)
|
||||||
pg_log(PG_FATAL, "cannot write to log file %s\n", log_file);
|
pg_log(PG_FATAL, "cannot write to log file %s\n", log_file);
|
||||||
fprintf(log, "\n\n");
|
fprintf(log, "\n\n");
|
||||||
fclose(log);
|
fclose(log);
|
||||||
|
@ -63,7 +63,11 @@ extern char *output_files[];
|
|||||||
#define SERVER_STOP_LOG_FILE SERVER_LOG_FILE
|
#define SERVER_STOP_LOG_FILE SERVER_LOG_FILE
|
||||||
#else
|
#else
|
||||||
#define SERVER_START_LOG_FILE "pg_upgrade_server_start.log"
|
#define SERVER_START_LOG_FILE "pg_upgrade_server_start.log"
|
||||||
/* pg_ctl stop doesn't keep the log file open, so reuse UTILITY_LOG_FILE */
|
/*
|
||||||
|
* "pg_ctl start" keeps SERVER_START_LOG_FILE and SERVER_LOG_FILE open
|
||||||
|
* while the server is running, so we use UTILITY_LOG_FILE for "pg_ctl
|
||||||
|
* stop".
|
||||||
|
*/
|
||||||
#define SERVER_STOP_LOG_FILE UTILITY_LOG_FILE
|
#define SERVER_STOP_LOG_FILE UTILITY_LOG_FILE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user