* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.341 2009/05/28 11:02:16 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.342 2009/06/02 06:18:06 heikki Exp $
*
*-------------------------------------------------------------------------
*/
struct dirent *xlde;
char lastoff[MAXFNAMELEN];
char path[MAXPGPATH];
+ struct stat statbuf;
/*
* Initialize info about where to try to recycle to. We allow recycling
/*
* 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,
- true, &max_advance,
- true))
+ if (lstat(path, &statbuf) == 0 && S_ISREG(statbuf.st_mode) &&
+ InstallXLogFileSegment(&endlogId, &endlogSeg, path,
+ true, &max_advance, true))
{
ereport(DEBUG2,
(errmsg("recycled transaction log file \"%s\"",