Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7c8d7a2

Browse files
committed
Only recycle normal files in pg_xlog as WAL segments. pg_standby creates
symbolic links with the -l option, and as Fujii Masao pointed out we ended upoverwriting files in the archive directory before this patch. Patch byAidan Van Dyk, Fujii Masao and me.Backpatch to 8.3, where pg_standby was introduced.
1 parentdb02073 commit7c8d7a2

File tree

1 file changed

+8
-5
lines changed
  • src/backend/access/transam

1 file changed

+8
-5
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.341 2009/05/28 11:02:16 heikki Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.342 2009/06/02 06:18:06 heikki Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -3006,6 +3006,7 @@ RemoveOldXlogFiles(uint32 log, uint32 seg, XLogRecPtr endptr)
30063006
structdirent*xlde;
30073007
charlastoff[MAXFNAMELEN];
30083008
charpath[MAXPGPATH];
3009+
structstatstatbuf;
30093010

30103011
/*
30113012
* Initialize info about where to try to recycle to. We allow recycling
@@ -3046,11 +3047,13 @@ RemoveOldXlogFiles(uint32 log, uint32 seg, XLogRecPtr endptr)
30463047

30473048
/*
30483049
* Before deleting the file, see if it can be recycled as a
3049-
* future log segment.
3050+
* future log segment. Only recycle normal files, pg_standby
3051+
* for example can create symbolic links pointing to a
3052+
* separate archive directory.
30503053
*/
3051-
if (InstallXLogFileSegment(&endlogId,&endlogSeg,path,
3052-
true,&max_advance,
3053-
true))
3054+
if (lstat(path,&statbuf)==0&&S_ISREG(statbuf.st_mode)&&
3055+
InstallXLogFileSegment(&endlogId,&endlogSeg,path,
3056+
true,&max_advance, true))
30543057
{
30553058
ereport(DEBUG2,
30563059
(errmsg("recycled transaction log file \"%s\"",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp