Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
b961b30c
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,体验更适合开发者的 AI 搜索 >>
提交
b961b30c
编写于
8月 14, 2020
作者:
B
Bhuvnesh Chaudhary
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip
上级
fd5f11ba
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
69 addition
and
5 deletion
+69
-5
contrib/pg_upgrade/greenplum/option_gp.c
contrib/pg_upgrade/greenplum/option_gp.c
+11
-0
contrib/pg_upgrade/greenplum/pg_upgrade_greenplum.h
contrib/pg_upgrade/greenplum/pg_upgrade_greenplum.h
+15
-2
contrib/pg_upgrade/greenplum/reporting.c
contrib/pg_upgrade/greenplum/reporting.c
+18
-0
contrib/pg_upgrade/relfilenode.c
contrib/pg_upgrade/relfilenode.c
+3
-0
contrib/pg_upgrade/util.c
contrib/pg_upgrade/util.c
+22
-3
未找到文件。
contrib/pg_upgrade/greenplum/option_gp.c
浏览文件 @
b961b30c
...
...
@@ -14,6 +14,7 @@ typedef struct {
segmentMode
segment_mode
;
checksumMode
checksum_mode
;
char
*
old_tablespace_file_path
;
bool
timing
;
}
GreenplumUserOpts
;
static
GreenplumUserOpts
greenplum_user_opts
;
...
...
@@ -69,6 +70,10 @@ process_greenplum_option(greenplumOption option, char *option_value)
greenplum_user_opts
.
old_tablespace_file_path
=
pg_strdup
(
optarg
);
break
;
case
GREENPLUM_TIMING
:
greenplum_user_opts
.
timing
=
true
;
break
;
default:
return
false
;
}
...
...
@@ -110,3 +115,9 @@ is_show_progress_mode(void)
{
return
greenplum_user_opts
.
progress
;
}
bool
is_timing_on
(
void
)
{
return
greenplum_user_opts
.
timing
;
}
contrib/pg_upgrade/greenplum/pg_upgrade_greenplum.h
浏览文件 @
b961b30c
...
...
@@ -9,6 +9,7 @@
#include "pg_upgrade.h"
#include <portability/instr_time.h>
#define PG_OPTIONS_UTILITY_MODE " PGOPTIONS='-c gp_session_role=utility' "
...
...
@@ -43,7 +44,8 @@ typedef enum {
GREENPLUM_REMOVE_CHECKSUM_OPTION
=
4
,
GREENPLUM_OLD_GP_DBID
=
5
,
GREENPLUM_NEW_GP_DBID
=
6
,
GREENPLUM_OLD_TABLESPACES_FILE
=
7
GREENPLUM_OLD_TABLESPACES_FILE
=
7
,
GREENPLUM_TIMING
=
8
,
}
greenplumOption
;
...
...
@@ -54,7 +56,8 @@ typedef enum {
{"remove-checksum", no_argument, NULL, GREENPLUM_REMOVE_CHECKSUM_OPTION}, \
{"old-gp-dbid", required_argument, NULL, GREENPLUM_OLD_GP_DBID}, \
{"new-gp-dbid", required_argument, NULL, GREENPLUM_NEW_GP_DBID}, \
{"old-tablespaces-file", required_argument, NULL, GREENPLUM_OLD_TABLESPACES_FILE},
{"old-tablespaces-file", required_argument, NULL, GREENPLUM_OLD_TABLESPACES_FILE}, \
{"timing", no_argument, NULL, GREENPLUM_TIMING},
#define GREENPLUM_USAGE "\
--mode=TYPE designate node type to upgrade, \"segment\" or \"dispatcher\" (default \"segment\")\n\
...
...
@@ -64,6 +67,7 @@ typedef enum {
--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\
--timing enable timing\n\
"
/* option_gp.c */
...
...
@@ -73,6 +77,7 @@ bool is_greenplum_dispatcher_mode(void);
bool
is_checksum_mode
(
checksumMode
mode
);
bool
is_show_progress_mode
(
void
);
void
validate_greenplum_options
(
void
);
bool
is_timing_on
(
void
);
/* pg_upgrade_greenplum.c */
void
freeze_all_databases
(
void
);
...
...
@@ -118,6 +123,7 @@ void check_greenplum(void);
void
report_progress
(
ClusterInfo
*
cluster
,
progress_type
op
,
char
*
fmt
,...)
pg_attribute_printf
(
3
,
4
);
void
close_progress
(
void
);
void
duration
(
instr_time
duration
,
char
*
res
);
/* tablespace_gp.c */
...
...
@@ -135,4 +141,11 @@ is_gpdb6(ClusterInfo *cluster)
return
GET_MAJOR_VERSION
(
cluster
->
major_version
)
==
904
;
}
static
struct
{
instr_time
start_time
;
instr_time
end_time
;
}
step_timing
;
void
check_ok_with_timing
(
void
);
#endif
/* PG_UPGRADE_GREENPLUM_H */
contrib/pg_upgrade/greenplum/reporting.c
浏览文件 @
b961b30c
...
...
@@ -126,3 +126,21 @@ close_progress(void)
progress_counter
=
0
;
progress_prev
=
epoch_us
();
}
void
duration
(
instr_time
duration
,
char
*
res
)
{
int
seconds
=
INSTR_TIME_GET_DOUBLE
(
duration
);
int
h
=
(
seconds
/
3600
);
int
m
=
(
seconds
-
(
3600
*
h
))
/
60
;
int
s
=
(
seconds
-
(
3600
*
h
)
-
(
m
*
60
));
if
(
h
>
0
)
{
sprintf
(
res
,
"[ %dh%dm%ds ]"
,
h
,
m
,
s
);
}
else
if
(
m
>
0
)
{
sprintf
(
res
,
"[ %dm%ds ]"
,
m
,
s
);
}
else
if
(
s
>
0
){
sprintf
(
res
,
"[ %ds ]"
,
s
);
}
else
{
sprintf
(
res
,
"[ %.3f ms ]"
,
INSTR_TIME_GET_MILLISEC
(
duration
));
}
}
\ No newline at end of file
contrib/pg_upgrade/relfilenode.c
浏览文件 @
b961b30c
...
...
@@ -38,6 +38,9 @@ void
transfer_all_new_tablespaces
(
DbInfoArr
*
old_db_arr
,
DbInfoArr
*
new_db_arr
,
char
*
old_pgdata
,
char
*
new_pgdata
)
{
if
(
is_timing_on
())
INSTR_TIME_SET_CURRENT
(
step_timing
.
start_time
);
pg_log
(
PG_REPORT
,
"%s user relation files
\n
"
,
user_opts
.
transfer_mode
==
TRANSFER_MODE_LINK
?
"Linking"
:
"Copying"
);
...
...
contrib/pg_upgrade/util.c
浏览文件 @
b961b30c
...
...
@@ -70,6 +70,9 @@ prep_status(const char *fmt,...)
va_list
args
;
char
message
[
MAX_STRING
];
if
(
is_timing_on
())
INSTR_TIME_SET_CURRENT
(
step_timing
.
start_time
);
va_start
(
args
,
fmt
);
vsnprintf
(
message
,
sizeof
(
message
),
fmt
,
args
);
va_end
(
args
);
...
...
@@ -168,13 +171,29 @@ pg_fatal(const char *fmt,...)
exit
(
1
);
}
void
check_ok_with_timing
(
void
)
{
char
*
elapsed_time
=
"adsfasdfa"
;
INSTR_TIME_SET_CURRENT
(
step_timing
.
end_time
);
INSTR_TIME_SUBTRACT
(
step_timing
.
end_time
,
step_timing
.
start_time
);
// duration(step_timing.end_time, elapsed_time);
report_status
(
PG_REPORT
,
"ok %s"
,
elapsed_time
);
fflush
(
stdout
);
// pfree(elapsed_time);
}
void
check_ok
(
void
)
{
/* all seems well */
report_status
(
PG_REPORT
,
"ok"
);
fflush
(
stdout
);
if
(
is_timing_on
())
check_ok_with_timing
();
else
{
/* all seems well */
report_status
(
PG_REPORT
,
"ok"
);
fflush
(
stdout
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录