HDFS-13586. Fsync fails on directories on Windows. Contributed by Lukas Majercack.
(cherry picked from commit 8783613696
)
This commit is contained in:
parent
a5ec44c655
commit
c4d4ae62cb
|
@ -398,6 +398,13 @@ public class IOUtils {
|
|||
"File/Directory " + fileToSync.getAbsolutePath() + " does not exist");
|
||||
}
|
||||
boolean isDir = fileToSync.isDirectory();
|
||||
|
||||
// HDFS-13586, FileChannel.open fails with AccessDeniedException
|
||||
// for any directory, ignore.
|
||||
if (isDir && Shell.WINDOWS) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the file is a directory we have to open read-only, for regular files
|
||||
// we must open r/w for the fsync to have an effect. See
|
||||
// http://blog.httrack.com/blog/2013/11/15/
|
||||
|
|
Loading…
Reference in New Issue