Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
5f1600b7
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,发现更多精彩内容 >>
提交
5f1600b7
编写于
12月 09, 2019
作者:
A
Adam Berlin
提交者:
Adam Berlin
12月 16, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Extract Greenplum option parsing from postgres option parsing.
上级
36bd2285
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
95 addition
and
61 deletion
+95
-61
contrib/pg_upgrade/greenplum/option_gp.c
contrib/pg_upgrade/greenplum/option_gp.c
+55
-0
contrib/pg_upgrade/greenplum/pg_upgrade_greenplum.h
contrib/pg_upgrade/greenplum/pg_upgrade_greenplum.h
+33
-0
contrib/pg_upgrade/option.c
contrib/pg_upgrade/option.c
+7
-59
contrib/pg_upgrade/pg_upgrade.h
contrib/pg_upgrade/pg_upgrade.h
+0
-2
未找到文件。
contrib/pg_upgrade/greenplum/option_gp.c
浏览文件 @
5f1600b7
#include "pg_upgrade_greenplum.h"
GreenplumUserOpts
greenplum_user_opts
;
void
initialize_greenplum_user_options
(
void
)
{
greenplum_user_opts
.
segment_mode
=
SEGMENT
;
}
bool
process_greenplum_option
(
int
option
,
char
*
option_value
)
{
switch
(
option
)
{
case
GREENPLUM_MODE_OPTION
:
/* --mode={dispatcher|segment} */
if
(
pg_strcasecmp
(
"dispatcher"
,
optarg
)
==
0
)
greenplum_user_opts
.
segment_mode
=
DISPATCHER
;
else
if
(
pg_strcasecmp
(
"segment"
,
optarg
)
==
0
)
greenplum_user_opts
.
segment_mode
=
SEGMENT
;
else
{
pg_log
(
PG_FATAL
,
"invalid segment configuration
\n
"
);
exit
(
1
);
}
break
;
case
GREENPLUM_PROGRESS_OPTION
:
/* --progress */
greenplum_user_opts
.
progress
=
true
;
break
;
case
GREENPLUM_ADD_CHECKSUM_OPTION
:
/* --add-checksum */
greenplum_user_opts
.
checksum_mode
=
CHECKSUM_ADD
;
break
;
case
GREENPLUM_REMOVE_CHECKSUM_OPTION
:
/* --remove-checksum */
greenplum_user_opts
.
checksum_mode
=
CHECKSUM_REMOVE
;
break
;
case
GREENPLUM_OLD_GP_DBID
:
/* --old-gp-dbid */
old_cluster
.
gp_dbid
=
atoi
(
optarg
);
break
;
case
GREENPLUM_NEW_GP_DBID
:
/* --new-gp-dbid */
new_cluster
.
gp_dbid
=
atoi
(
optarg
);
break
;
case
GREENPLUM_OLD_TABLESPACES_FILE
:
/* --old-tablespaces-file */
greenplum_user_opts
.
old_tablespace_file_path
=
pg_strdup
(
optarg
);
break
;
default:
return
false
;
}
return
true
;
}
contrib/pg_upgrade/greenplum/pg_upgrade_greenplum.h
浏览文件 @
5f1600b7
...
...
@@ -12,13 +12,46 @@
#define PG_OPTIONS_UTILITY_MODE " PGOPTIONS='-c gp_session_role=utility' "
typedef
struct
{
bool
progress
;
segmentMode
segment_mode
;
checksumMode
checksum_mode
;
char
*
old_tablespace_file_path
;
}
GreenplumUserOpts
;
#define GREENPLUM_MODE_OPTION 1
#define GREENPLUM_PROGRESS_OPTION 2
#define GREENPLUM_ADD_CHECKSUM_OPTION 3
#define GREENPLUM_REMOVE_CHECKSUM_OPTION 4
#define GREENPLUM_OLD_GP_DBID 5
#define GREENPLUM_NEW_GP_DBID 6
#define GREENPLUM_OLD_TABLESPACES_FILE 7
#define GREENPLUM_OPTIONS \
{"mode", required_argument, NULL, GREENPLUM_MODE_OPTION}, \
{"progress", no_argument, NULL, GREENPLUM_PROGRESS_OPTION}, \
{"add-checksum", no_argument, NULL, GREENPLUM_ADD_CHECKSUM_OPTION}, \
{"remove-checksum", no_argument, NULL, GREENPLUM_REMOVE_CHECKSUM_OPTION},
{
"old-gp-dbid"
,
required_argument
,
NULL
,
5
},
{
"new-gp-dbid"
,
required_argument
,
NULL
,
6
},
{
"old-tablespaces-file"
,
required_argument
,
NULL
,
7
},
#define GREENPLUM_USAGE "\
--mode=TYPE designate node type to upgrade, \"segment\" or \"dispatcher\" (default \"segment\")\n\
--progress enable progress reporting\n\
--remove-checksum remove data checksums when creating new cluster\n\
--add-checksum add data checksumming to the new cluster\n\
--old-gp-dbid greenplum database id of the old segment\n\
--new-gp-dbid greenplum database id of the new segment\n\
--old-tablespaces-file file containing the tablespaces from an old gpdb five cluster\n\
"
/* option_gp.c */
extern
GreenplumUserOpts
greenplum_user_opts
;
void
initialize_greenplum_user_options
(
void
);
bool
process_greenplum_option
(
int
option
,
char
*
option_value
);
/* aotable.c */
...
...
contrib/pg_upgrade/option.c
浏览文件 @
5f1600b7
...
...
@@ -58,13 +58,7 @@ parseCommandLine(int argc, char *argv[])
{
"verbose"
,
no_argument
,
NULL
,
'v'
},
/* Greenplum specific parameters */
{
"mode"
,
required_argument
,
NULL
,
1
},
{
"progress"
,
no_argument
,
NULL
,
2
},
{
"add-checksum"
,
no_argument
,
NULL
,
3
},
{
"remove-checksum"
,
no_argument
,
NULL
,
4
},
{
"old-gp-dbid"
,
required_argument
,
NULL
,
5
},
{
"new-gp-dbid"
,
required_argument
,
NULL
,
6
},
{
"old-tablespaces-file"
,
required_argument
,
NULL
,
7
},
GREENPLUM_OPTIONS
{
NULL
,
0
,
NULL
,
0
}
};
...
...
@@ -90,7 +84,7 @@ parseCommandLine(int argc, char *argv[])
os_user_effective_id
=
get_user_info
(
&
os_info
.
user
);
greenplum_user_opts
.
segment_mode
=
SEGMENT
;
initialize_greenplum_user_options
()
;
/* we override just the database user name; we got the OS id above */
if
(
getenv
(
"PGUSER"
))
...
...
@@ -208,50 +202,10 @@ parseCommandLine(int argc, char *argv[])
log_opts
.
verbose
=
true
;
break
;
/*
* Greenplum specific parameters
*/
case
1
:
/* --mode={dispatcher|segment} */
if
(
pg_strcasecmp
(
"dispatcher"
,
optarg
)
==
0
)
greenplum_user_opts
.
segment_mode
=
DISPATCHER
;
else
if
(
pg_strcasecmp
(
"segment"
,
optarg
)
==
0
)
greenplum_user_opts
.
segment_mode
=
SEGMENT
;
else
{
pg_log
(
PG_FATAL
,
"invalid segment configuration
\n
"
);
exit
(
1
);
}
break
;
case
2
:
/* --progress */
greenplum_user_opts
.
progress
=
true
;
break
;
case
3
:
/* --add-checksum */
greenplum_user_opts
.
checksum_mode
=
CHECKSUM_ADD
;
break
;
case
4
:
/* --remove-checksum */
greenplum_user_opts
.
checksum_mode
=
CHECKSUM_REMOVE
;
break
;
case
5
:
/* --old-gp-dbid */
old_cluster
.
gp_dbid
=
atoi
(
optarg
);
break
;
case
6
:
/* --new-gp-dbid */
new_cluster
.
gp_dbid
=
atoi
(
optarg
);
break
;
case
7
:
/* --old-tablespaces-file */
user_opts
.
old_tablespace_file_path
=
pg_strdup
(
optarg
);
break
;
default:
pg_fatal
(
"Try
\"
%s --help
\"
for more information.
\n
"
,
os_info
.
progname
);
if
(
!
process_greenplum_option
(
option
,
pg_strdup
(
optarg
)))
pg_fatal
(
"Try
\"
%s --help
\"
for more information.
\n
"
,
os_info
.
progname
);
break
;
}
}
...
...
@@ -338,13 +292,7 @@ Options:\n\
-U, --username=NAME cluster superuser (default
\"
%s
\"
)
\n
\
-v, --verbose enable verbose internal logging
\n
\
-V, --version display version information, then exit
\n
\
--mode=TYPE designate node type to upgrade,
\"
segment
\"
or
\"
dispatcher
\"
(default
\"
segment
\"
)
\n
\
--progress enable progress reporting
\n
\
--remove-checksum remove data checksums when creating new cluster
\n
\
--add-checksum add data checksumming to the new cluster
\n
\
--old-gp-dbid greenplum database id of the old segment
\n
\
--new-gp-dbid greenplum database id of the new segment
\n
\
--old-tablespaces-file file containing the tablespaces from an old gpdb five cluster
\n
\
%s\
-?, --help show this help, then exit
\n
\
\n
\
Before running pg_upgrade you must:
\n
\
...
...
@@ -360,7 +308,7 @@ When you run pg_upgrade, you must provide the following information:\n\
\n
\
For example:
\n
\
pg_upgrade -d oldCluster/data -D newCluster/data -b oldCluster/bin -B newCluster/bin
\n
\
or
\n
"
),
old_cluster
.
port
,
new_cluster
.
port
,
os_info
.
user
);
or
\n
"
),
old_cluster
.
port
,
new_cluster
.
port
,
os_info
.
user
,
GREENPLUM_USAGE
);
#ifndef WIN32
printf
(
_
(
"\
$ export PGDATAOLD=oldCluster/data
\n
\
...
...
contrib/pg_upgrade/pg_upgrade.h
浏览文件 @
5f1600b7
...
...
@@ -439,8 +439,6 @@ typedef struct
transferMode
transfer_mode
;
/* copy files or link them? */
int
jobs
;
/* number of processes/threads to use */
char
*
socketdir
;
/* directory to use for Unix sockets */
char
*
old_tablespace_file_path
;
}
UserOpts
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录