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
691a67b9
Commit
691a67b9
authored
Oct 20, 2010
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename pg_upgrade 'log' to 'log_opts', to avoid platform naming conflict.
parent
3325c9bd
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
48 additions
and
48 deletions
+48
-48
contrib/pg_upgrade/check.c
contrib/pg_upgrade/check.c
+1
-1
contrib/pg_upgrade/controldata.c
contrib/pg_upgrade/controldata.c
+2
-2
contrib/pg_upgrade/info.c
contrib/pg_upgrade/info.c
+2
-2
contrib/pg_upgrade/option.c
contrib/pg_upgrade/option.c
+14
-14
contrib/pg_upgrade/pg_upgrade.c
contrib/pg_upgrade/pg_upgrade.c
+11
-11
contrib/pg_upgrade/pg_upgrade.h
contrib/pg_upgrade/pg_upgrade.h
+3
-3
contrib/pg_upgrade/server.c
contrib/pg_upgrade/server.c
+2
-2
contrib/pg_upgrade/util.c
contrib/pg_upgrade/util.c
+13
-13
No files found.
contrib/pg_upgrade/check.c
View file @
691a67b9
...
...
@@ -160,7 +160,7 @@ issue_warnings(char *sequence_script_file_name)
"--no-psqlrc --port %d --username
\"
%s
\"
"
"-f
\"
%s
\"
--dbname template1 >>
\"
%s
\"
"
SYSTEMQUOTE
,
new_cluster
.
bindir
,
new_cluster
.
port
,
os_info
.
user
,
sequence_script_file_name
,
log
.
filename
);
sequence_script_file_name
,
log
_opts
.
filename
);
unlink
(
sequence_script_file_name
);
check_ok
();
}
...
...
contrib/pg_upgrade/controldata.c
View file @
691a67b9
...
...
@@ -126,8 +126,8 @@ get_control_data(ClusterInfo *cluster, bool live_check)
/* we have the result of cmd in "output". so parse it line by line now */
while
(
fgets
(
bufin
,
sizeof
(
bufin
),
output
))
{
if
(
log
.
debug
)
fputs
(
bufin
,
log
.
debug_fd
);
if
(
log
_opts
.
debug
)
fputs
(
bufin
,
log
_opts
.
debug_fd
);
#ifdef WIN32
...
...
contrib/pg_upgrade/info.c
View file @
691a67b9
...
...
@@ -192,7 +192,7 @@ map_rel_by_id(Oid oldid, Oid newid,
void
print_maps
(
FileNameMap
*
maps
,
int
n
,
const
char
*
dbName
)
{
if
(
log
.
debug
)
if
(
log
_opts
.
debug
)
{
int
mapnum
;
...
...
@@ -277,7 +277,7 @@ get_db_and_rel_infos(DbInfoArr *db_arr, Cluster whichCluster)
get_rel_infos
(
&
db_arr
->
dbs
[
dbnum
],
&
db_arr
->
dbs
[
dbnum
].
rel_arr
,
whichCluster
);
if
(
log
.
debug
)
if
(
log
_opts
.
debug
)
dbarr_print
(
db_arr
,
whichCluster
);
}
...
...
contrib/pg_upgrade/option.c
View file @
691a67b9
...
...
@@ -119,11 +119,11 @@ parseCommandLine(int argc, char *argv[])
case
'g'
:
pg_log
(
PG_REPORT
,
"Running in debug mode
\n
"
);
log
.
debug
=
true
;
log
_opts
.
debug
=
true
;
break
;
case
'G'
:
if
((
log
.
debug_fd
=
fopen
(
optarg
,
"w"
))
==
NULL
)
if
((
log
_opts
.
debug_fd
=
fopen
(
optarg
,
"w"
))
==
NULL
)
{
pg_log
(
PG_FATAL
,
"cannot open debug file
\n
"
);
exit_nicely
(
false
);
...
...
@@ -135,7 +135,7 @@ parseCommandLine(int argc, char *argv[])
break
;
case
'l'
:
log
.
filename
=
pg_strdup
(
optarg
);
log
_opts
.
filename
=
pg_strdup
(
optarg
);
break
;
case
'p'
:
...
...
@@ -161,7 +161,7 @@ parseCommandLine(int argc, char *argv[])
case
'v'
:
pg_log
(
PG_REPORT
,
"Running in verbose mode
\n
"
);
log
.
verbose
=
true
;
log
_opts
.
verbose
=
true
;
break
;
default:
...
...
@@ -172,7 +172,7 @@ parseCommandLine(int argc, char *argv[])
}
}
if
(
log
.
filename
!=
NULL
)
if
(
log
_opts
.
filename
!=
NULL
)
{
/*
* We must use append mode so output generated by child processes via
...
...
@@ -180,20 +180,20 @@ parseCommandLine(int argc, char *argv[])
* start.
*/
/* truncate */
if
((
log
.
fd
=
fopen
(
log
.
filename
,
"w"
))
==
NULL
)
pg_log
(
PG_FATAL
,
"Cannot write to log file %s
\n
"
,
log
.
filename
);
fclose
(
log
.
fd
);
if
((
log
.
fd
=
fopen
(
log
.
filename
,
"a"
))
==
NULL
)
pg_log
(
PG_FATAL
,
"Cannot write to log file %s
\n
"
,
log
.
filename
);
if
((
log
_opts
.
fd
=
fopen
(
log_opts
.
filename
,
"w"
))
==
NULL
)
pg_log
(
PG_FATAL
,
"Cannot write to log file %s
\n
"
,
log
_opts
.
filename
);
fclose
(
log
_opts
.
fd
);
if
((
log
_opts
.
fd
=
fopen
(
log_opts
.
filename
,
"a"
))
==
NULL
)
pg_log
(
PG_FATAL
,
"Cannot write to log file %s
\n
"
,
log
_opts
.
filename
);
}
else
log
.
filename
=
strdup
(
DEVNULL
);
log
_opts
.
filename
=
strdup
(
DEVNULL
);
/* if no debug file name, output to the terminal */
if
(
log
.
debug
&&
!
log
.
debug_fd
)
if
(
log
_opts
.
debug
&&
!
log_opts
.
debug_fd
)
{
log
.
debug_fd
=
fopen
(
DEVTTY
,
"w"
);
if
(
!
log
.
debug_fd
)
log
_opts
.
debug_fd
=
fopen
(
DEVTTY
,
"w"
);
if
(
!
log
_opts
.
debug_fd
)
pg_log
(
PG_FATAL
,
"Cannot write to terminal
\n
"
);
}
...
...
contrib/pg_upgrade/pg_upgrade.c
View file @
691a67b9
...
...
@@ -162,7 +162,7 @@ prepare_new_cluster(void)
exec_prog
(
true
,
SYSTEMQUOTE
"
\"
%s/vacuumdb
\"
--port %d --username
\"
%s
\"
"
"--all --analyze >> %s 2>&1"
SYSTEMQUOTE
,
new_cluster
.
bindir
,
new_cluster
.
port
,
os_info
.
user
,
log
.
filename
);
new_cluster
.
bindir
,
new_cluster
.
port
,
os_info
.
user
,
log
_opts
.
filename
);
check_ok
();
/*
...
...
@@ -175,7 +175,7 @@ prepare_new_cluster(void)
exec_prog
(
true
,
SYSTEMQUOTE
"
\"
%s/vacuumdb
\"
--port %d --username
\"
%s
\"
"
"--all --freeze >> %s 2>&1"
SYSTEMQUOTE
,
new_cluster
.
bindir
,
new_cluster
.
port
,
os_info
.
user
,
log
.
filename
);
new_cluster
.
bindir
,
new_cluster
.
port
,
os_info
.
user
,
log
_opts
.
filename
);
check_ok
();
get_pg_database_relfilenode
(
CLUSTER_NEW
);
...
...
@@ -207,7 +207,7 @@ prepare_new_databases(void)
"--no-psqlrc --port %d --username
\"
%s
\"
"
"-f
\"
%s/%s
\"
--dbname template1 >>
\"
%s
\"
"
SYSTEMQUOTE
,
new_cluster
.
bindir
,
new_cluster
.
port
,
os_info
.
user
,
os_info
.
cwd
,
GLOBALS_DUMP_FILE
,
log
.
filename
);
GLOBALS_DUMP_FILE
,
log
_opts
.
filename
);
check_ok
();
get_db_and_rel_infos
(
&
new_cluster
.
dbarr
,
CLUSTER_NEW
);
...
...
@@ -230,7 +230,7 @@ create_new_objects(void)
"--no-psqlrc --port %d --username
\"
%s
\"
"
"-f
\"
%s/%s
\"
--dbname template1 >>
\"
%s
\"
"
SYSTEMQUOTE
,
new_cluster
.
bindir
,
new_cluster
.
port
,
os_info
.
user
,
os_info
.
cwd
,
DB_DUMP_FILE
,
log
.
filename
);
DB_DUMP_FILE
,
log
_opts
.
filename
);
check_ok
();
/* regenerate now that we have db schemas */
...
...
@@ -282,7 +282,7 @@ copy_clog_xlog_xid(void)
exec_prog
(
true
,
SYSTEMQUOTE
"
\"
%s/pg_resetxlog
\"
-l %u,%u,%u
\"
%s
\"
>>
\"
%s
\"
2>&1"
SYSTEMQUOTE
,
new_cluster
.
bindir
,
old_cluster
.
controldata
.
chkpnt_tli
,
old_cluster
.
controldata
.
logid
,
old_cluster
.
controldata
.
nxtlogseg
,
new_cluster
.
pgdata
,
log
.
filename
);
new_cluster
.
pgdata
,
log
_opts
.
filename
);
check_ok
();
}
...
...
@@ -384,7 +384,7 @@ cleanup(void)
dbarr_free
(
&
old_cluster
.
dbarr
);
dbarr_free
(
&
new_cluster
.
dbarr
);
pg_free
(
log
.
filename
);
pg_free
(
log
_opts
.
filename
);
pg_free
(
os_info
.
user
);
pg_free
(
old_cluster
.
major_version_str
);
pg_free
(
new_cluster
.
major_version_str
);
...
...
@@ -397,14 +397,14 @@ cleanup(void)
pg_free
(
old_cluster
.
tablespace_suffix
);
pg_free
(
new_cluster
.
tablespace_suffix
);
if
(
log
.
fd
!=
NULL
)
if
(
log
_opts
.
fd
!=
NULL
)
{
fclose
(
log
.
fd
);
log
.
fd
=
NULL
;
fclose
(
log
_opts
.
fd
);
log
_opts
.
fd
=
NULL
;
}
if
(
log
.
debug_fd
)
fclose
(
log
.
debug_fd
);
if
(
log
_opts
.
debug_fd
)
fclose
(
log
_opts
.
debug_fd
);
snprintf
(
filename
,
sizeof
(
filename
),
"%s/%s"
,
os_info
.
cwd
,
ALL_DUMP_FILE
);
unlink
(
filename
);
...
...
contrib/pg_upgrade/pg_upgrade.h
View file @
691a67b9
...
...
@@ -197,7 +197,7 @@ typedef struct
/*
* Log
* Log
Opts
*/
typedef
struct
{
...
...
@@ -206,7 +206,7 @@ typedef struct
bool
debug
;
/* TRUE -> log more information */
FILE
*
debug_fd
;
/* debug-level log FILE */
bool
verbose
;
/* TRUE -> be verbose in messages */
}
Log
;
}
Log
Opts
;
/*
...
...
@@ -241,7 +241,7 @@ typedef struct
/*
* Global variables
*/
extern
Log
log
;
extern
Log
Opts
log_opts
;
extern
UserOpts
user_opts
;
extern
ClusterInfo
old_cluster
,
new_cluster
;
...
...
contrib/pg_upgrade/server.c
View file @
691a67b9
...
...
@@ -185,7 +185,7 @@ start_postmaster(Cluster whichCluster, bool quiet)
"start >>
\"
%s
\"
2>&1"
SYSTEMQUOTE
,
bindir
,
#ifndef WIN32
log
.
filename
,
datadir
,
port
,
log
.
filename
);
log
_opts
.
filename
,
datadir
,
port
,
log_opts
.
filename
);
#else
DEVNULL
,
datadir
,
port
,
DEVNULL
);
#endif
...
...
@@ -229,7 +229,7 @@ stop_postmaster(bool fast, bool quiet)
"
\"
%s
\"
2>&1"
SYSTEMQUOTE
,
bindir
,
#ifndef WIN32
log
.
filename
,
datadir
,
fast
?
"-m fast"
:
""
,
log
.
filename
);
log
_opts
.
filename
,
datadir
,
fast
?
"-m fast"
:
""
,
log_opts
.
filename
);
#else
DEVNULL
,
datadir
,
fast
?
"-m fast"
:
""
,
DEVNULL
);
#endif
...
...
contrib/pg_upgrade/util.c
View file @
691a67b9
...
...
@@ -12,7 +12,7 @@
#include <signal.h>
Log
log
;
Log
Opts
log_opts
;
/*
* report_status()
...
...
@@ -75,19 +75,19 @@ pg_log(eLogType type, char *fmt,...)
vsnprintf
(
message
,
sizeof
(
message
),
fmt
,
args
);
va_end
(
args
);
if
(
log
.
fd
!=
NULL
)
if
(
log
_opts
.
fd
!=
NULL
)
{
fwrite
(
message
,
strlen
(
message
),
1
,
log
.
fd
);
fwrite
(
message
,
strlen
(
message
),
1
,
log
_opts
.
fd
);
/* if we are using OVERWRITE_MESSAGE, add newline */
if
(
strchr
(
message
,
'\r'
)
!=
NULL
)
fwrite
(
"
\n
"
,
1
,
1
,
log
.
fd
);
fflush
(
log
.
fd
);
fwrite
(
"
\n
"
,
1
,
1
,
log
_opts
.
fd
);
fflush
(
log
_opts
.
fd
);
}
switch
(
type
)
{
case
PG_INFO
:
if
(
log
.
verbose
)
if
(
log
_opts
.
verbose
)
printf
(
"%s"
,
_
(
message
));
break
;
...
...
@@ -103,8 +103,8 @@ pg_log(eLogType type, char *fmt,...)
break
;
case
PG_DEBUG
:
if
(
log
.
debug
)
fprintf
(
log
.
debug_fd
,
"%s
\n
"
,
_
(
message
));
if
(
log
_opts
.
debug
)
fprintf
(
log
_opts
.
debug_fd
,
"%s
\n
"
,
_
(
message
));
break
;
default:
...
...
@@ -189,13 +189,13 @@ exit_nicely(bool need_cleanup)
{
stop_postmaster
(
true
,
true
);
pg_free
(
log
.
filename
);
pg_free
(
log
_opts
.
filename
);
if
(
log
.
fd
)
fclose
(
log
.
fd
);
if
(
log
_opts
.
fd
)
fclose
(
log
_opts
.
fd
);
if
(
log
.
debug_fd
)
fclose
(
log
.
debug_fd
);
if
(
log
_opts
.
debug_fd
)
fclose
(
log
_opts
.
debug_fd
);
/* terminate any running instance of postmaster */
if
(
os_info
.
postmasterPID
!=
0
)
...
...
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