Index: src/backend/access/transam/xlog.c =================================================================== RCS file: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v retrieving revision 1.197 diff -c -c -r1.197 xlog.c *** src/backend/access/transam/xlog.c 6 Jun 2005 20:22:57 -0000 1.197 --- src/backend/access/transam/xlog.c 9 Jun 2005 01:52:53 -0000 *************** *** 2289,2339 **** * We use the alphanumeric sorting property of the filenames to * decide which ones are earlier than the lastoff segment. */ ! if (strlen(xlde->d_name) == 24 && ! strspn(xlde->d_name, "0123456789ABCDEF") == 24 && strcmp(xlde->d_name + 8, lastoff + 8) <= 0) { ! bool recycle; ! ! if (XLogArchivingActive()) ! recycle = XLogArchiveIsDone(xlde->d_name); ! else ! recycle = true; ! ! if (recycle) { ! snprintf(path, MAXPGPATH, "%s/%s", XLogDir, xlde->d_name); ! ! /* ! * Before deleting the file, see if it can be recycled as ! * a future log segment. ! */ ! if (InstallXLogFileSegment(&endlogId, &endlogSeg, path, ! true, &max_advance, ! true)) { ! ereport(DEBUG2, ! (errmsg("recycled transaction log file \"%s\"", ! xlde->d_name))); ! (*nsegsrecycled)++; ! /* Needn't recheck that slot on future iterations */ ! if (max_advance > 0) { ! NextLogSeg(endlogId, endlogSeg); ! max_advance--; } } ! else { - /* No need for any more future segments... */ ereport(DEBUG2, ! (errmsg("removing transaction log file \"%s\"", xlde->d_name))); unlink(path); ! (*nsegsremoved)++; } - - XLogArchiveCleanup(xlde->d_name); } } errno = 0; --- 2289,2354 ---- * We use the alphanumeric sorting property of the filenames to * decide which ones are earlier than the lastoff segment. */ ! if (strspn(xlde->d_name, "0123456789ABCDEF") == 24 && strcmp(xlde->d_name + 8, lastoff + 8) <= 0) { ! snprintf(path, MAXPGPATH, "%s/%s", XLogDir, xlde->d_name); ! ! if (strlen(xlde->d_name) == 24) { ! bool recycle; ! ! if (XLogArchivingActive()) ! recycle = XLogArchiveIsDone(xlde->d_name); ! else ! recycle = true; ! ! if (recycle) { ! /* ! * Before deleting the file, see if it can be recycled as ! * a future log segment. ! */ ! if (InstallXLogFileSegment(&endlogId, &endlogSeg, path, ! true, &max_advance, ! true)) ! { ! ereport(DEBUG2, ! (errmsg("recycled transaction log file \"%s\"", ! xlde->d_name))); ! (*nsegsrecycled)++; ! /* Needn't recheck that slot on future iterations */ ! if (max_advance > 0) ! { ! NextLogSeg(endlogId, endlogSeg); ! max_advance--; ! } ! } ! else { ! /* No need for any more future segments... */ ! ereport(DEBUG2, ! (errmsg("removing transaction log file \"%s\"", ! xlde->d_name))); ! unlink(path); ! (*nsegsremoved)++; } + XLogArchiveCleanup(xlde->d_name); } ! } ! else if (strlen(xlde->d_name) > 24 && ! strcmp(xlde->d_name + strlen(xlde->d_name) - strlen(".backup"), ! ".backup") == 0) ! { ! /* Remove any *.backup files that have been archived. */ ! if (!XLogArchivingActive() || XLogArchiveIsDone(xlde->d_name)) { ereport(DEBUG2, ! (errmsg("removing transaction log backup status file \"%s\"", xlde->d_name))); unlink(path); ! XLogArchiveCleanup(xlde->d_name); } } } errno = 0;