This is an automated email from the ASF dual-hosted git repository.

jbrennan pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.2 by this push:
     new 431046d  Revert "HADOOP-17306. RawLocalFileSystem's lastModifiedTime() 
looses milli seconds in JDK < 10.b09 (#2387)"
431046d is described below

commit 431046d76686f4941360422ead1f4b0c4056e3ef
Author: Jim Brennan <[email protected]>
AuthorDate: Thu Nov 5 17:22:22 2020 +0000

    Revert "HADOOP-17306. RawLocalFileSystem's lastModifiedTime() looses milli 
seconds in JDK < 10.b09 (#2387)"
    
    This reverts commit 8c6478b4058025e01e81a6c372ec3e9dfa36f196.
---
 .../org/apache/hadoop/fs/RawLocalFileSystem.java   | 11 +++-------
 .../hadoop/fs/TestRawLocalFileSystemContract.java  | 25 ----------------------
 2 files changed, 3 insertions(+), 33 deletions(-)

diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
index 5a9a44a..cf22105 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
@@ -71,12 +71,7 @@ public class RawLocalFileSystem extends FileSystem {
   public static void useStatIfAvailable() {
     useDeprecatedFileStatus = !Stat.isAvailable();
   }
-
-  @VisibleForTesting
-  static void setUseDeprecatedFileStatus(boolean useDeprecatedFileStatus) {
-    RawLocalFileSystem.useDeprecatedFileStatus = useDeprecatedFileStatus;
-  }
-
+  
   public RawLocalFileSystem() {
     workingDir = getInitialWorkingDirectory();
   }
@@ -698,8 +693,8 @@ public class RawLocalFileSystem extends FileSystem {
     DeprecatedRawLocalFileStatus(File f, long defaultBlockSize, FileSystem fs)
       throws IOException {
       super(f.length(), f.isDirectory(), 1, defaultBlockSize,
-          Files.getLastModifiedTime(f.toPath()).toMillis(),
-          getLastAccessTime(f),null, null, null,
+          f.lastModified(), getLastAccessTime(f),
+          null, null, null,
           new Path(f.getPath()).makeQualified(fs.getUri(),
             fs.getWorkingDirectory()));
     }
diff --git 
a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestRawLocalFileSystemContract.java
 
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestRawLocalFileSystemContract.java
index 0d57e8f..3892f16 100644
--- 
a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestRawLocalFileSystemContract.java
+++ 
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestRawLocalFileSystemContract.java
@@ -18,7 +18,6 @@
 package org.apache.hadoop.fs;
 
 import java.io.File;
-import java.io.IOException;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.test.GenericTestUtils;
@@ -168,28 +167,4 @@ public class TestRawLocalFileSystemContract extends 
FileSystemContractBaseTest {
     }
   }
 
-  @Test
-  public void testMTimeAtime() throws IOException {
-    RawLocalFileSystem.setUseDeprecatedFileStatus(true);
-    try {
-      Path testDir = getTestBaseDir();
-      String testFilename = "testmtime";
-      Path path = new Path(testDir, testFilename);
-      Path file = new Path(path, "file");
-      fs.create(file);
-      long now = System.currentTimeMillis();
-      long mtime = (now % 1000 == 0) ? now + 1 : now;
-      long atime = (now % 1000 == 0) ? now + 2 : now;
-      fs.setTimes(file, mtime, atime);
-      FileStatus fileStatus = fs.getFileStatus(file);
-      if (!Shell.MAC) {
-        // HADOOP-17306 ; Skip MacOS because HFS+ does not support
-        // milliseconds for mtime.
-        assertEquals(mtime, fileStatus.getModificationTime());
-      }
-      assertEquals(atime, fileStatus.getAccessTime());
-    } finally {
-      RawLocalFileSystem.useStatIfAvailable();
-    }
-  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to