hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dran...@apache.org
Subject hadoop git commit: HADOOP-14065. AliyunOSS: oss directory filestatus should use meta time. Contributed by Fei Hui
Date Thu, 09 Feb 2017 10:00:45 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 37b4acf7c -> a8a594b4c


HADOOP-14065. AliyunOSS: oss directory filestatus should use meta time. Contributed by Fei
Hui


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/a8a594b4
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/a8a594b4
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/a8a594b4

Branch: refs/heads/trunk
Commit: a8a594b4c89319bef294534755f0e4ed6198ec88
Parents: 37b4acf
Author: Kai Zheng <kai.zheng@intel.com>
Authored: Thu Feb 9 18:00:22 2017 +0800
Committer: Kai Zheng <kai.zheng@intel.com>
Committed: Thu Feb 9 18:00:22 2017 +0800

----------------------------------------------------------------------
 .../apache/hadoop/fs/aliyun/oss/AliyunOSSFileSystem.java    | 3 ++-
 .../hadoop/fs/aliyun/oss/TestAliyunOSSInputStream.java      | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/a8a594b4/hadoop-tools/hadoop-aliyun/src/main/java/org/apache/hadoop/fs/aliyun/oss/AliyunOSSFileSystem.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-aliyun/src/main/java/org/apache/hadoop/fs/aliyun/oss/AliyunOSSFileSystem.java
b/hadoop-tools/hadoop-aliyun/src/main/java/org/apache/hadoop/fs/aliyun/oss/AliyunOSSFileSystem.java
index 3b266c8..3426319 100644
--- a/hadoop-tools/hadoop-aliyun/src/main/java/org/apache/hadoop/fs/aliyun/oss/AliyunOSSFileSystem.java
+++ b/hadoop-tools/hadoop-aliyun/src/main/java/org/apache/hadoop/fs/aliyun/oss/AliyunOSSFileSystem.java
@@ -218,7 +218,8 @@ public class AliyunOSSFileSystem extends FileSystem {
         throw new FileNotFoundException(path + ": No such file or directory!");
       }
     } else if (objectRepresentsDirectory(key, meta.getContentLength())) {
-      return new FileStatus(0, true, 1, 0, 0, qualifiedPath);
+      return new FileStatus(0, true, 1, 0, meta.getLastModified().getTime(),
+           qualifiedPath);
     } else {
       return new FileStatus(meta.getContentLength(), false, 1,
           getDefaultBlockSize(path), meta.getLastModified().getTime(),

http://git-wip-us.apache.org/repos/asf/hadoop/blob/a8a594b4/hadoop-tools/hadoop-aliyun/src/test/java/org/apache/hadoop/fs/aliyun/oss/TestAliyunOSSInputStream.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-aliyun/src/test/java/org/apache/hadoop/fs/aliyun/oss/TestAliyunOSSInputStream.java
b/hadoop-tools/hadoop-aliyun/src/test/java/org/apache/hadoop/fs/aliyun/oss/TestAliyunOSSInputStream.java
index 37af28f..10c4edd 100644
--- a/hadoop-tools/hadoop-aliyun/src/test/java/org/apache/hadoop/fs/aliyun/oss/TestAliyunOSSInputStream.java
+++ b/hadoop-tools/hadoop-aliyun/src/test/java/org/apache/hadoop/fs/aliyun/oss/TestAliyunOSSInputStream.java
@@ -24,6 +24,7 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.contract.ContractTestUtils;
 import org.apache.hadoop.io.IOUtils;
+import org.apache.hadoop.fs.FileStatus;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
@@ -142,4 +143,12 @@ public class TestAliyunOSSInputStream {
     assertTrue(instream.available() == 0);
     IOUtils.closeStream(instream);
   }
+  @Test
+  public void testDirectoryModifiedTime() throws Exception {
+    Path emptyDirPath = setPath("/test/emptyDirectory");
+    fs.mkdirs(emptyDirPath);
+    FileStatus dirFileStatus = fs.getFileStatus(emptyDirPath);
+    assertTrue("expected the empty dir is new",
+        dirFileStatus.getModificationTime() > 0L);
+  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message