HDFS-13586. Fsync fails on directories on Windows. Contributed by Lukas Majercack.
(cherry picked from commit 8783613696674aba4ae1739c6e8f48cda0d1c386)
This commit is contained in:
parent
cdc16b3a2f
commit
7336d0123d
@ -400,6 +400,13 @@ public static void fsync(File fileToSync) throws IOException {
|
||||
"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…
x
Reference in New Issue
Block a user