*** pgsql/src/port/dirmod.c 2008/04/11 23:59:49 1.51.2.2 --- pgsql/src/port/dirmod.c 2008/04/18 06:48:50 1.51.2.3 *************** *** 10,16 **** * Win32 (NT, Win2k, XP). replace() doesn't work on Win95/98/Me. * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/port/dirmod.c,v 1.51.2.1 2008/04/10 16:59:10 mha Exp $ * *------------------------------------------------------------------------- */ --- 10,16 ---- * Win32 (NT, Win2k, XP). replace() doesn't work on Win95/98/Me. * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/port/dirmod.c,v 1.51.2.2 2008/04/11 23:59:49 tgl Exp $ * *------------------------------------------------------------------------- */ *************** rmtree(char *path, bool rmtopdir) *** 406,413 **** { snprintf(filepath, MAXPGPATH, "%s/%s", path, *filename); if (lstat(filepath, &statbuf) != 0) ! goto report_and_fail; if (S_ISDIR(statbuf.st_mode)) { --- 406,429 ---- { snprintf(filepath, MAXPGPATH, "%s/%s", path, *filename); + /* + * It's ok if the file is not there anymore; we were just about to + * delete it anyway. + * + * This is not an academic possibility. One scenario where this + * happens is when bgwriter has a pending unlink request for a file + * in a database that's being dropped. In dropdb(), we call + * ForgetDatabaseFsyncRequests() to flush out any such pending unlink + * requests, but because that's asynchronous, it's not guaranteed + * that the bgwriter receives the message in time. + */ if (lstat(filepath, &statbuf) != 0) ! { ! if (errno != ENOENT) ! goto report_and_fail; ! else ! continue; ! } if (S_ISDIR(statbuf.st_mode)) { *************** rmtree(char *path, bool rmtopdir) *** 422,428 **** else { if (unlink(filepath) != 0) ! goto report_and_fail; } } --- 438,447 ---- else { if (unlink(filepath) != 0) ! { ! if (errno != ENOENT) ! goto report_and_fail; ! } } }