Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 68cfc75

Browse files
committed
Temporarily disable fsyncing the database directory in CREATE DATABASE
until we can work out portability issues the build farm uncovered. In passing avoid fsyncing subdirectories twice.
1 parent bec8103 commit 68cfc75

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/port/copydir.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* as a service.
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/port/copydir.c,v 1.27 2010/02/15 04:05:06 itagaki Exp $
14+
* $PostgreSQL: pgsql/src/port/copydir.c,v 1.28 2010/02/15 11:40:49 stark Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -101,22 +101,36 @@ copydir(char *fromdir, char *todir, bool recurse)
101101

102102
while ((xlde = ReadDir(xldir, fromdir)) != NULL)
103103
{
104+
struct stat fst;
105+
104106
if (strcmp(xlde->d_name, ".") == 0 ||
105107
strcmp(xlde->d_name, "..") == 0)
106108
continue;
107109

108110
snprintf(tofile, MAXPGPATH, "%s/%s", todir, xlde->d_name);
109-
fsync_fname(tofile);
111+
112+
/* We don't need to sync directories here since the recursive
113+
* copydir will do it before it returns */
114+
if (lstat(fromfile, &fst) < 0)
115+
ereport(ERROR,
116+
(errcode_for_file_access(),
117+
errmsg("could not stat file \"%s\": %m", fromfile)));
118+
if (S_ISREG(fst.st_mode))
119+
{
120+
fsync_fname(tofile);
121+
}
110122
}
111123
FreeDir(xldir);
112124

125+
#ifdef NOTYET
113126
/* It's important to fsync the destination directory itself as
114127
* individual file fsyncs don't guarantee that the directory entry
115128
* for the file is synced. Recent versions of ext4 have made the
116129
* window much wider but it's been true for ext3 and other
117-
* filesyetems in the past
130+
* filesystems in the past
118131
*/
119132
fsync_fname(todir);
133+
#endif
120134
}
121135

122136
/*

0 commit comments

Comments
 (0)