diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/access/transam/xlog.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 43742370e8a..27683452eaa 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7,7 +7,7 @@ * 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.345.2.8 2010/03/18 09:18:54 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.345.2.9 2010/06/09 10:54:53 mha Exp $ * *------------------------------------------------------------------------- */ @@ -2038,9 +2038,21 @@ XLogBackgroundFlush(void) flexible = false; /* ensure it all gets written */ } - /* Done if already known flushed */ + /* + * If already known flushed, we're done. Just need to check if we + * are holding an open file handle to a logfile that's no longer + * in use, preventing the file from being deleted. + */ if (XLByteLE(WriteRqstPtr, LogwrtResult.Flush)) + { + if (openLogFile >= 0) { + if (!XLByteInPrevSeg(LogwrtResult.Write, openLogId, openLogSeg)) + { + XLogFileClose(); + } + } return; + } #ifdef WAL_DEBUG if (XLOG_DEBUG) |