Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
c7516384
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c7516384
编写于
4月 06, 2011
作者:
P
Peter Eisentraut
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace the confusing exit_nicely() by an atexit/on_exit hook
上级
2bd78eb8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
37 addition
and
43 deletion
+37
-43
contrib/pg_upgrade/check.c
contrib/pg_upgrade/check.c
+1
-1
contrib/pg_upgrade/option.c
contrib/pg_upgrade/option.c
+5
-5
contrib/pg_upgrade/pg_upgrade.h
contrib/pg_upgrade/pg_upgrade.h
+0
-1
contrib/pg_upgrade/server.c
contrib/pg_upgrade/server.c
+29
-5
contrib/pg_upgrade/util.c
contrib/pg_upgrade/util.c
+2
-31
未找到文件。
contrib/pg_upgrade/check.c
浏览文件 @
c7516384
...
...
@@ -131,7 +131,7 @@ report_clusters_compatible(void)
pg_log
(
PG_REPORT
,
"
\n
*Clusters are compatible*
\n
"
);
/* stops new cluster */
stop_postmaster
(
false
,
false
);
exit
_nicely
(
false
);
exit
(
0
);
}
pg_log
(
PG_REPORT
,
"
\n
"
...
...
contrib/pg_upgrade/option.c
浏览文件 @
c7516384
...
...
@@ -77,12 +77,12 @@ parseCommandLine(int argc, char *argv[])
strcmp
(
argv
[
1
],
"-?"
)
==
0
)
{
usage
();
exit
_nicely
(
false
);
exit
(
0
);
}
if
(
strcmp
(
argv
[
1
],
"--version"
)
==
0
||
strcmp
(
argv
[
1
],
"-V"
)
==
0
)
{
pg_log
(
PG_REPORT
,
"pg_upgrade "
PG_VERSION
"
\n
"
);
exit
_nicely
(
false
);
exit
(
0
);
}
}
...
...
@@ -125,7 +125,7 @@ parseCommandLine(int argc, char *argv[])
if
((
log_opts
.
debug_fd
=
fopen
(
optarg
,
"w"
))
==
NULL
)
{
pg_log
(
PG_FATAL
,
"cannot open debug file
\n
"
);
exit
_nicely
(
false
);
exit
(
1
);
}
break
;
...
...
@@ -141,7 +141,7 @@ parseCommandLine(int argc, char *argv[])
if
((
old_cluster
.
port
=
atoi
(
optarg
))
<=
0
)
{
pg_log
(
PG_FATAL
,
"invalid old port number
\n
"
);
exit
_nicely
(
false
);
exit
(
1
);
}
break
;
...
...
@@ -149,7 +149,7 @@ parseCommandLine(int argc, char *argv[])
if
((
new_cluster
.
port
=
atoi
(
optarg
))
<=
0
)
{
pg_log
(
PG_FATAL
,
"invalid new port number
\n
"
);
exit
_nicely
(
false
);
exit
(
1
);
}
break
;
...
...
contrib/pg_upgrade/pg_upgrade.h
浏览文件 @
c7516384
...
...
@@ -363,7 +363,6 @@ void check_for_libpq_envvars(void);
/* util.c */
void
exit_nicely
(
bool
need_cleanup
);
char
*
quote_identifier
(
const
char
*
s
);
int
get_user_info
(
char
**
user_name
);
void
check_ok
(
void
);
...
...
contrib/pg_upgrade/server.c
浏览文件 @
c7516384
...
...
@@ -23,7 +23,7 @@ static bool test_server_conn(ClusterInfo *cluster, int timeout);
*
* Connects to the desired database on the designated server.
* If the connection attempt fails, this function logs an error
* message and calls exit
_nicely
() to kill the program.
* message and calls exit() to kill the program.
*/
PGconn
*
connectToServer
(
ClusterInfo
*
cluster
,
const
char
*
db_name
)
...
...
@@ -45,7 +45,8 @@ connectToServer(ClusterInfo *cluster, const char *db_name)
if
(
conn
)
PQfinish
(
conn
);
exit_nicely
(
true
);
printf
(
"Failure, exiting
\n
"
);
exit
(
1
);
}
return
conn
;
...
...
@@ -57,7 +58,7 @@ connectToServer(ClusterInfo *cluster, const char *db_name)
*
* Formats a query string from the given arguments and executes the
* resulting query. If the query fails, this function logs an error
* message and calls exit
_nicely
() to kill the program.
* message and calls exit() to kill the program.
*/
PGresult
*
executeQueryOrDie
(
PGconn
*
conn
,
const
char
*
fmt
,...)
...
...
@@ -81,8 +82,8 @@ executeQueryOrDie(PGconn *conn, const char *fmt,...)
PQerrorMessage
(
conn
));
PQclear
(
result
);
PQfinish
(
conn
);
exit_nicely
(
true
);
return
NULL
;
/* Never get here, but keeps compiler happy */
printf
(
"Failure, exiting
\n
"
);
exit
(
1
);
}
else
return
result
;
...
...
@@ -152,6 +153,18 @@ get_major_server_version(ClusterInfo *cluster)
}
static
void
#ifdef HAVE_ATEXIT
stop_postmaster_atexit
(
void
)
#else
stop_postmaster_on_exit
(
int
exitstatus
,
void
*
arg
)
#endif
{
stop_postmaster
(
true
,
true
);
}
void
start_postmaster
(
ClusterInfo
*
cluster
,
bool
quiet
)
{
...
...
@@ -159,11 +172,22 @@ start_postmaster(ClusterInfo *cluster, bool quiet)
const
char
*
bindir
;
const
char
*
datadir
;
unsigned
short
port
;
bool
exit_hook_registered
=
false
;
bindir
=
cluster
->
bindir
;
datadir
=
cluster
->
pgdata
;
port
=
cluster
->
port
;
if
(
!
exit_hook_registered
)
{
#ifdef HAVE_ATEXIT
atexit
(
stop_postmaster_atexit
);
#else
on_exit
(
stop_postmaster_on_exit
);
#endif
exit_hook_registered
=
true
;
}
/*
* 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
...
...
contrib/pg_upgrade/util.c
浏览文件 @
c7516384
...
...
@@ -99,7 +99,8 @@ pg_log(eLogType type, char *fmt,...)
case
PG_FATAL
:
printf
(
"%s"
,
"
\n
"
);
printf
(
"%s"
,
_
(
message
));
exit_nicely
(
true
);
printf
(
"Failure, exiting
\n
"
);
exit
(
1
);
break
;
case
PG_DEBUG
:
...
...
@@ -184,36 +185,6 @@ get_user_info(char **user_name)
}
void
exit_nicely
(
bool
need_cleanup
)
{
stop_postmaster
(
true
,
true
);
pg_free
(
log_opts
.
filename
);
if
(
log_opts
.
fd
)
fclose
(
log_opts
.
fd
);
if
(
log_opts
.
debug_fd
)
fclose
(
log_opts
.
debug_fd
);
/* terminate any running instance of postmaster */
if
(
os_info
.
postmasterPID
!=
0
)
kill
(
os_info
.
postmasterPID
,
SIGTERM
);
if
(
need_cleanup
)
{
printf
(
"Failure, exiting
\n
"
);
/*
* FIXME must delete intermediate files
*/
exit
(
1
);
}
else
exit
(
0
);
}
void
*
pg_malloc
(
int
n
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录