Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
476291be
Commit
476291be
authored
May 23, 2012
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust pg_upgrade to output a separate log file for pg_ctl output on
Windows, to avoid opening a file by multiple processes.
parent
77f93cb3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
24 deletions
+24
-24
contrib/pg_upgrade/option.c
contrib/pg_upgrade/option.c
+6
-5
contrib/pg_upgrade/pg_upgrade.c
contrib/pg_upgrade/pg_upgrade.c
+13
-15
contrib/pg_upgrade/pg_upgrade.h
contrib/pg_upgrade/pg_upgrade.h
+5
-4
No files found.
contrib/pg_upgrade/option.c
View file @
476291be
...
...
@@ -57,7 +57,7 @@ parseCommandLine(int argc, char *argv[])
int
optindex
=
0
;
/* used by getopt_long */
int
os_user_effective_id
;
FILE
*
fp
;
int
i
;
char
**
filename
;
time_t
run_time
=
time
(
NULL
);
user_opts
.
transfer_mode
=
TRANSFER_MODE_COPY
;
...
...
@@ -188,11 +188,12 @@ parseCommandLine(int argc, char *argv[])
}
/* label start of upgrade in logfiles */
for
(
i
=
0
;
i
<
NUM_LOG_FILES
;
i
++
)
for
(
filename
=
output_files
;
*
filename
!=
NULL
;
filename
++
)
{
if
((
fp
=
fopen_priv
(
output_files
[
i
],
"a"
))
==
NULL
)
pg_log
(
PG_FATAL
,
"cannot write to log file %s
\n
"
,
output_files
[
i
]);
if
((
fp
=
fopen_priv
(
*
filename
,
"a"
))
==
NULL
)
pg_log
(
PG_FATAL
,
"cannot write to log file %s
\n
"
,
*
filename
);
/* Start with newline because we might be appending to a file. */
fprintf
(
fp
,
"
\n
"
"-----------------------------------------------------------------
\n
"
" pg_upgrade run on %s"
...
...
contrib/pg_upgrade/pg_upgrade.c
View file @
476291be
...
...
@@ -55,11 +55,16 @@ ClusterInfo old_cluster,
new_cluster
;
OSInfo
os_info
;
char
*
output_files
[
NUM_LOG_FILES
]
=
{
char
*
output_files
[]
=
{
SERVER_LOG_FILE
,
#ifdef WIN32
/* file is unique on Win32 */
SERVER_LOG_FILE2
,
#endif
RESTORE_LOG_FILE
,
UTILITY_LOG_FILE
,
INTERNAL_LOG_FILE
INTERNAL_LOG_FILE
,
NULL
};
...
...
@@ -454,21 +459,14 @@ cleanup(void)
/* Remove dump and log files? */
if
(
!
log_opts
.
retain
)
{
char
filename
[
MAXPGPATH
];
int
i
;
char
**
filename
;
for
(
i
=
0
;
i
<
NUM_LOG_FILES
;
i
++
)
{
snprintf
(
filename
,
sizeof
(
filename
),
"%s"
,
output_files
[
i
]);
unlink
(
filename
);
}
for
(
filename
=
output_files
;
*
filename
!=
NULL
;
filename
++
)
unlink
(
*
filename
);
/* remove SQL files */
snprintf
(
filename
,
sizeof
(
filename
),
"%s"
,
ALL_DUMP_FILE
);
unlink
(
filename
);
snprintf
(
filename
,
sizeof
(
filename
),
"%s"
,
GLOBALS_DUMP_FILE
);
unlink
(
filename
);
snprintf
(
filename
,
sizeof
(
filename
),
"%s"
,
DB_DUMP_FILE
);
unlink
(
filename
);
unlink
(
ALL_DUMP_FILE
);
unlink
(
GLOBALS_DUMP_FILE
);
unlink
(
DB_DUMP_FILE
);
}
}
contrib/pg_upgrade/pg_upgrade.h
View file @
476291be
...
...
@@ -40,7 +40,6 @@
#define UTILITY_LOG_FILE "pg_upgrade_utility.log"
#define INTERNAL_LOG_FILE "pg_upgrade_internal.log"
#define NUM_LOG_FILES 4
extern
char
*
output_files
[];
/*
...
...
@@ -49,8 +48,10 @@ extern char *output_files[];
* On Win32, we can't send both pg_upgrade output and command 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 send the pg_ctl
* command-line output to the utility log file on Windows, 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
* 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
...
...
@@ -60,7 +61,7 @@ extern char *output_files[];
#ifndef WIN32
#define SERVER_LOG_FILE2 SERVER_LOG_FILE
#else
#define SERVER_LOG_FILE2
UTILITY_LOG_FILE
#define SERVER_LOG_FILE2
"pg_upgrade_server2.log"
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment