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 up overwriting files in the archive directory before this patch. Patch by Aidan Van Dyk, Fujii Masao and me. Backpatch to 8.3, where pg_standby was introduced.
This commit is contained in:
parent
6b4a3a7700
commit
c0dd9f7a3c
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.292.2.6 2009/05/07 11:25:28 heikki Exp $
|
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.292.2.7 2009/06/02 06:19:41 heikki Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -2696,6 +2696,7 @@ RemoveOldXlogFiles(uint32 log, uint32 seg, XLogRecPtr endptr)
|
|||||||
struct dirent *xlde;
|
struct dirent *xlde;
|
||||||
char lastoff[MAXFNAMELEN];
|
char lastoff[MAXFNAMELEN];
|
||||||
char path[MAXPGPATH];
|
char path[MAXPGPATH];
|
||||||
|
struct stat statbuf;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize info about where to try to recycle to. We allow recycling
|
* Initialize info about where to try to recycle to. We allow recycling
|
||||||
@ -2736,11 +2737,13 @@ RemoveOldXlogFiles(uint32 log, uint32 seg, XLogRecPtr endptr)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Before deleting the file, see if it can be recycled as a
|
* Before deleting the file, see if it can be recycled as a
|
||||||
* future log segment.
|
* future log segment. Only recycle normal files, pg_standby
|
||||||
|
* for example can create symbolic links pointing to a
|
||||||
|
* separate archive directory.
|
||||||
*/
|
*/
|
||||||
if (InstallXLogFileSegment(&endlogId, &endlogSeg, path,
|
if (lstat(path, &statbuf) == 0 && S_ISREG(statbuf.st_mode) &&
|
||||||
true, &max_advance,
|
InstallXLogFileSegment(&endlogId, &endlogSeg, path,
|
||||||
true))
|
true, &max_advance, true))
|
||||||
{
|
{
|
||||||
ereport(DEBUG2,
|
ereport(DEBUG2,
|
||||||
(errmsg("recycled transaction log file \"%s\"",
|
(errmsg("recycled transaction log file \"%s\"",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user