diff options
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 03440cbf48b..9b590061731 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.253 2006/11/05 22:42:08 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.254 2006/11/08 20:12:04 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -2140,7 +2140,9 @@ XLogFileCopy(uint32 log, uint32 seg, * caller must *not* hold the lock at call. * * Returns TRUE if file installed, FALSE if not installed because of - * exceeding max_advance limit. (Any other kind of failure causes ereport().) + * exceeding max_advance limit. On Windows, we also return FALSE if we + * can't rename the file into place because someone's got it open. + * (Any other kind of failure causes ereport().) */ static bool InstallXLogFileSegment(uint32 *log, uint32 *seg, char *tmppath, @@ -2195,10 +2197,25 @@ InstallXLogFileSegment(uint32 *log, uint32 *seg, char *tmppath, unlink(tmppath); #else if (rename(tmppath, path) < 0) + { +#ifdef WIN32 +#if !defined(__CYGWIN__) + if (GetLastError() == ERROR_ACCESS_DENIED) +#else + if (errno == EACCES) +#endif + { + if (use_lock) + LWLockRelease(ControlFileLock); + return false; + } +#endif /* WIN32 */ + ereport(ERROR, (errcode_for_file_access(), errmsg("could not rename file \"%s\" to \"%s\" (initialization of log file %u, segment %u): %m", tmppath, path, *log, *seg))); + } #endif if (use_lock) |