Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
4da8fc05
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,发现更多精彩内容 >>
提交
4da8fc05
编写于
7月 26, 2012
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Simplify pg_upgrade's handling when returning directory listings.
Backpatch to 9.2.
上级
af026b5d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
26 deletion
+17
-26
contrib/pg_upgrade/file.c
contrib/pg_upgrade/file.c
+8
-17
contrib/pg_upgrade/pg_upgrade.h
contrib/pg_upgrade/pg_upgrade.h
+1
-1
contrib/pg_upgrade/relfilenode.c
contrib/pg_upgrade/relfilenode.c
+8
-8
未找到文件。
contrib/pg_upgrade/file.c
浏览文件 @
4da8fc05
...
...
@@ -225,23 +225,21 @@ copy_file(const char *srcfile, const char *dstfile, bool force)
* load_directory()
*
* Read all the file names in the specified directory, and return them as
* an array of "
struct dirent
" pointers. The array address is returned in
* an array of "
char *
" pointers. The array address is returned in
* *namelist, and the function result is the count of file names.
*
* To free the result data, free each
namelist
array member, then free the
* To free the result data, free each
(char *)
array member, then free the
* namelist array itself.
*/
int
load_directory
(
const
char
*
dirname
,
struct
dirent
***
namelist
)
load_directory
(
const
char
*
dirname
,
char
***
namelist
)
{
DIR
*
dirdesc
;
struct
dirent
*
direntry
;
int
count
=
0
;
int
allocsize
=
64
;
size_t
entrysize
;
int
allocsize
=
64
;
/* initial array size */
*
namelist
=
(
struct
dirent
**
)
pg_malloc
(
allocsize
*
sizeof
(
struct
dirent
*
));
*
namelist
=
(
char
**
)
pg_malloc
(
allocsize
*
sizeof
(
char
*
));
if
((
dirdesc
=
opendir
(
dirname
))
==
NULL
)
pg_log
(
PG_FATAL
,
"could not open directory
\"
%s
\"
: %s
\n
"
,
...
...
@@ -252,18 +250,11 @@ load_directory(const char *dirname, struct dirent *** namelist)
if
(
count
>=
allocsize
)
{
allocsize
*=
2
;
*
namelist
=
(
struct
dirent
**
)
pg_realloc
(
*
namelist
,
allocsize
*
sizeof
(
struct
dirent
*
));
*
namelist
=
(
char
**
)
pg_realloc
(
*
namelist
,
allocsize
*
sizeof
(
char
*
));
}
entrysize
=
offsetof
(
struct
dirent
,
d_name
)
+
strlen
(
direntry
->
d_name
)
+
1
;
(
*
namelist
)[
count
]
=
(
struct
dirent
*
)
pg_malloc
(
entrysize
);
memcpy
((
*
namelist
)[
count
],
direntry
,
entrysize
);
count
++
;
(
*
namelist
)[
count
++
]
=
pg_strdup
(
direntry
->
d_name
);
}
#ifdef WIN32
...
...
contrib/pg_upgrade/pg_upgrade.h
浏览文件 @
4da8fc05
...
...
@@ -356,7 +356,7 @@ const char *setupPageConverter(pageCnvCtx **result);
typedef
void
*
pageCnvCtx
;
#endif
int
load_directory
(
const
char
*
dirname
,
struct
dirent
***
namelist
);
int
load_directory
(
const
char
*
dirname
,
char
***
namelist
);
const
char
*
copyAndUpdateFile
(
pageCnvCtx
*
pageConverter
,
const
char
*
src
,
const
char
*
dst
,
bool
force
);
const
char
*
linkAndUpdateFile
(
pageCnvCtx
*
pageConverter
,
const
char
*
src
,
...
...
contrib/pg_upgrade/relfilenode.c
浏览文件 @
4da8fc05
...
...
@@ -133,7 +133,7 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
{
char
old_dir
[
MAXPGPATH
];
char
file_pattern
[
MAXPGPATH
];
struct
dirent
**
namelist
=
NULL
;
char
**
namelist
=
NULL
;
int
numFiles
=
0
;
int
mapnum
;
int
fileno
;
...
...
@@ -192,21 +192,21 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
for
(
fileno
=
0
;
fileno
<
numFiles
;
fileno
++
)
{
char
*
vm_offset
=
strstr
(
namelist
[
fileno
]
->
d_name
,
"_vm"
);
char
*
vm_offset
=
strstr
(
namelist
[
fileno
],
"_vm"
);
bool
is_vm_file
=
false
;
/* Is a visibility map file? (name ends with _vm) */
if
(
vm_offset
&&
strlen
(
vm_offset
)
==
strlen
(
"_vm"
))
is_vm_file
=
true
;
if
(
strncmp
(
namelist
[
fileno
]
->
d_name
,
file_pattern
,
if
(
strncmp
(
namelist
[
fileno
],
file_pattern
,
strlen
(
file_pattern
))
==
0
&&
(
!
is_vm_file
||
!
vm_crashsafe_change
))
{
snprintf
(
old_file
,
sizeof
(
old_file
),
"%s/%s"
,
maps
[
mapnum
].
old_dir
,
namelist
[
fileno
]
->
d_name
);
namelist
[
fileno
]);
snprintf
(
new_file
,
sizeof
(
new_file
),
"%s/%u%s"
,
maps
[
mapnum
].
new_dir
,
maps
[
mapnum
].
new_relfilenode
,
strchr
(
namelist
[
fileno
]
->
d_name
,
'_'
));
maps
[
mapnum
].
new_relfilenode
,
strchr
(
namelist
[
fileno
],
'_'
));
unlink
(
new_file
);
transfer_relfile
(
pageConverter
,
old_file
,
new_file
,
...
...
@@ -227,13 +227,13 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
for
(
fileno
=
0
;
fileno
<
numFiles
;
fileno
++
)
{
if
(
strncmp
(
namelist
[
fileno
]
->
d_name
,
file_pattern
,
if
(
strncmp
(
namelist
[
fileno
],
file_pattern
,
strlen
(
file_pattern
))
==
0
)
{
snprintf
(
old_file
,
sizeof
(
old_file
),
"%s/%s"
,
maps
[
mapnum
].
old_dir
,
namelist
[
fileno
]
->
d_name
);
namelist
[
fileno
]);
snprintf
(
new_file
,
sizeof
(
new_file
),
"%s/%u%s"
,
maps
[
mapnum
].
new_dir
,
maps
[
mapnum
].
new_relfilenode
,
strchr
(
namelist
[
fileno
]
->
d_name
,
'.'
));
maps
[
mapnum
].
new_relfilenode
,
strchr
(
namelist
[
fileno
],
'.'
));
unlink
(
new_file
);
transfer_relfile
(
pageConverter
,
old_file
,
new_file
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录