Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
f4d907ca
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,发现更多精彩内容 >>
提交
f4d907ca
编写于
6月 15, 2005
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove old *.backup files when we do pg_stop_backup(). This
prevents a large number of *.backup files from existing in pg_xlog/
上级
713507b0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
59 addition
and
1 deletion
+59
-1
src/backend/access/transam/xlog.c
src/backend/access/transam/xlog.c
+59
-1
未找到文件。
src/backend/access/transam/xlog.c
浏览文件 @
f4d907ca
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.
199 2005/06/09 22:36:27
momjian Exp $
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.
200 2005/06/15 01:36:08
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -450,6 +450,7 @@ static bool RestoreArchivedFile(char *path, const char *xlogfname,
static
int
PreallocXlogFiles
(
XLogRecPtr
endptr
);
static
void
MoveOfflineLogs
(
uint32
log
,
uint32
seg
,
XLogRecPtr
endptr
,
int
*
nsegsremoved
,
int
*
nsegsrecycled
);
static
void
RemoveOldBackupHistory
(
void
);
static
XLogRecord
*
ReadRecord
(
XLogRecPtr
*
RecPtr
,
int
emode
);
static
bool
ValidXLOGHeader
(
XLogPageHeader
hdr
,
int
emode
);
static
XLogRecord
*
ReadCheckpointRecord
(
XLogRecPtr
RecPtr
,
int
whichChkpt
);
...
...
@@ -2355,6 +2356,61 @@ MoveOfflineLogs(uint32 log, uint32 seg, XLogRecPtr endptr,
FreeDir
(
xldir
);
}
/*
* Remove previous backup history files
*/
static
void
RemoveOldBackupHistory
(
void
)
{
DIR
*
xldir
;
struct
dirent
*
xlde
;
char
path
[
MAXPGPATH
];
xldir
=
AllocateDir
(
XLogDir
);
if
(
xldir
==
NULL
)
ereport
(
ERROR
,
(
errcode_for_file_access
(),
errmsg
(
"could not open transaction log directory
\"
%s
\"
: %m"
,
XLogDir
)));
errno
=
0
;
while
((
xlde
=
readdir
(
xldir
))
!=
NULL
)
{
if
(
strlen
(
xlde
->
d_name
)
>
24
&&
strspn
(
xlde
->
d_name
,
"0123456789ABCDEF"
)
==
24
&&
strcmp
(
xlde
->
d_name
+
strlen
(
xlde
->
d_name
)
-
strlen
(
".backup"
),
".backup"
)
==
0
)
{
/* Remove any *.backup files that have been archived. */
if
(
!
XLogArchivingActive
()
||
XLogArchiveIsDone
(
xlde
->
d_name
))
{
ereport
(
DEBUG2
,
(
errmsg
(
"removing transaction log backup history file
\"
%s
\"
"
,
xlde
->
d_name
)));
snprintf
(
path
,
MAXPGPATH
,
"%s/%s"
,
XLogDir
,
xlde
->
d_name
);
unlink
(
path
);
XLogArchiveCleanup
(
xlde
->
d_name
);
}
}
errno
=
0
;
}
#ifdef WIN32
/*
* This fix is in mingw cvs (runtime/mingwex/dirent.c rev 1.4), but
* not in released version
*/
if
(
GetLastError
()
==
ERROR_NO_MORE_FILES
)
errno
=
0
;
#endif
if
(
errno
)
ereport
(
ERROR
,
(
errcode_for_file_access
(),
errmsg
(
"could not read transaction log directory
\"
%s
\"
: %m"
,
XLogDir
)));
FreeDir
(
xldir
);
}
/*
* Restore the backup blocks present in an XLOG record, if any.
*
...
...
@@ -5738,6 +5794,8 @@ pg_stop_backup(PG_FUNCTION_ARGS)
errmsg
(
"could not remove file
\"
%s
\"
: %m"
,
labelfilepath
)));
RemoveOldBackupHistory
();
/*
* Notify archiver that history file may be archived immediately
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录