Skip to content

Commit a314873

Browse files
committed
Revert "HADOOP-17306. RawLocalFileSystem's lastModifiedTime() looses milli seconds in JDK < 10.b09 (#2387)"
This reverts commit 553e27e.
1 parent fe53f58 commit a314873

File tree

2 files changed

+3
-33
lines changed

2 files changed

+3
-33
lines changed

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,7 @@ public class RawLocalFileSystem extends FileSystem {
7171
public static void useStatIfAvailable() {
7272
useDeprecatedFileStatus = !Stat.isAvailable();
7373
}
74-
75-
@VisibleForTesting
76-
static void setUseDeprecatedFileStatus(boolean useDeprecatedFileStatus) {
77-
RawLocalFileSystem.useDeprecatedFileStatus = useDeprecatedFileStatus;
78-
}
79-
74+
8075
public RawLocalFileSystem() {
8176
workingDir = getInitialWorkingDirectory();
8277
}
@@ -698,8 +693,8 @@ private static long getLastAccessTime(File f) throws IOException {
698693
DeprecatedRawLocalFileStatus(File f, long defaultBlockSize, FileSystem fs)
699694
throws IOException {
700695
super(f.length(), f.isDirectory(), 1, defaultBlockSize,
701-
Files.getLastModifiedTime(f.toPath()).toMillis(),
702-
getLastAccessTime(f),null, null, null,
696+
f.lastModified(), getLastAccessTime(f),
697+
null, null, null,
703698
new Path(f.getPath()).makeQualified(fs.getUri(),
704699
fs.getWorkingDirectory()));
705700
}

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestRawLocalFileSystemContract.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package org.apache.hadoop.fs;
1919

2020
import java.io.File;
21-
import java.io.IOException;
2221

2322
import org.apache.hadoop.conf.Configuration;
2423
import org.apache.hadoop.test.GenericTestUtils;
@@ -168,28 +167,4 @@ public void testPermission() throws Exception {
168167
}
169168
}
170169

171-
@Test
172-
public void testMTimeAtime() throws IOException {
173-
RawLocalFileSystem.setUseDeprecatedFileStatus(true);
174-
try {
175-
Path testDir = getTestBaseDir();
176-
String testFilename = "testmtime";
177-
Path path = new Path(testDir, testFilename);
178-
Path file = new Path(path, "file");
179-
fs.create(file);
180-
long now = System.currentTimeMillis();
181-
long mtime = (now % 1000 == 0) ? now + 1 : now;
182-
long atime = (now % 1000 == 0) ? now + 2 : now;
183-
fs.setTimes(file, mtime, atime);
184-
FileStatus fileStatus = fs.getFileStatus(file);
185-
if (!Shell.MAC) {
186-
// HADOOP-17306 ; Skip MacOS because HFS+ does not support
187-
// milliseconds for mtime.
188-
assertEquals(mtime, fileStatus.getModificationTime());
189-
}
190-
assertEquals(atime, fileStatus.getAccessTime());
191-
} finally {
192-
RawLocalFileSystem.useStatIfAvailable();
193-
}
194-
}
195170
}

0 commit comments

Comments
 (0)