|
7 | 7 | * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
8 | 8 | * Portions Copyright (c) 1994, Regents of the University of California
|
9 | 9 | *
|
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 $ |
11 | 11 | *
|
12 | 12 | *-------------------------------------------------------------------------
|
13 | 13 | */
|
@@ -3006,6 +3006,7 @@ RemoveOldXlogFiles(uint32 log, uint32 seg, XLogRecPtr endptr)
|
3006 | 3006 | struct dirent *xlde;
|
3007 | 3007 | char lastoff[MAXFNAMELEN];
|
3008 | 3008 | char path[MAXPGPATH];
|
| 3009 | + struct stat statbuf; |
3009 | 3010 |
|
3010 | 3011 | /*
|
3011 | 3012 | * Initialize info about where to try to recycle to. We allow recycling
|
@@ -3046,11 +3047,13 @@ RemoveOldXlogFiles(uint32 log, uint32 seg, XLogRecPtr endptr)
|
3046 | 3047 |
|
3047 | 3048 | /*
|
3048 | 3049 | * 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. |
3050 | 3053 | */
|
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)) |
3054 | 3057 | {
|
3055 | 3058 | ereport(DEBUG2,
|
3056 | 3059 | (errmsg("recycled transaction log file \"%s\"",
|
|
0 commit comments