Skip to content

Commit 638f1fc

Browse files
committed
Revert "HADOOP-17306. RawLocalFileSystem's lastModifiedTime() looses milli seconds in JDK < 10.b09 (#2387)"
This reverts commit d259928.
1 parent 7e52c09 commit 638f1fc

File tree

2 files changed

+3
-32
lines changed

2 files changed

+3
-32
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
@@ -72,12 +72,7 @@ public class RawLocalFileSystem extends FileSystem {
7272
public static void useStatIfAvailable() {
7373
useDeprecatedFileStatus = !Stat.isAvailable();
7474
}
75-
76-
@VisibleForTesting
77-
static void setUseDeprecatedFileStatus(boolean useDeprecatedFileStatus) {
78-
RawLocalFileSystem.useDeprecatedFileStatus = useDeprecatedFileStatus;
79-
}
80-
75+
8176
public RawLocalFileSystem() {
8277
workingDir = getInitialWorkingDirectory();
8378
}
@@ -705,8 +700,8 @@ private static long getLastAccessTime(File f) throws IOException {
705700
DeprecatedRawLocalFileStatus(File f, long defaultBlockSize, FileSystem fs)
706701
throws IOException {
707702
super(f.length(), f.isDirectory(), 1, defaultBlockSize,
708-
Files.getLastModifiedTime(f.toPath()).toMillis(),
709-
getLastAccessTime(f),null, null, null,
703+
f.lastModified(), getLastAccessTime(f),
704+
null, null, null,
710705
new Path(f.getPath()).makeQualified(fs.getUri(),
711706
fs.getWorkingDirectory()));
712707
}

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

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -203,28 +203,4 @@ public void testPermission() throws Exception {
203203
}
204204
}
205205

206-
@Test
207-
public void testMTimeAtime() throws IOException {
208-
RawLocalFileSystem.setUseDeprecatedFileStatus(true);
209-
try {
210-
Path testDir = getTestBaseDir();
211-
String testFilename = "testmtime";
212-
Path path = new Path(testDir, testFilename);
213-
Path file = new Path(path, "file");
214-
fs.create(file);
215-
long now = System.currentTimeMillis();
216-
long mtime = (now % 1000 == 0) ? now + 1 : now;
217-
long atime = (now % 1000 == 0) ? now + 2 : now;
218-
fs.setTimes(file, mtime, atime);
219-
FileStatus fileStatus = fs.getFileStatus(file);
220-
if (!Shell.MAC) {
221-
// HADOOP-17306 ; Skip MacOS because HFS+ does not support
222-
// milliseconds for mtime.
223-
assertEquals(mtime, fileStatus.getModificationTime());
224-
}
225-
assertEquals(atime, fileStatus.getAccessTime());
226-
} finally {
227-
RawLocalFileSystem.useStatIfAvailable();
228-
}
229-
}
230206
}

0 commit comments

Comments
 (0)