You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by sz...@apache.org on 2014/03/25 03:03:08 UTC

svn commit: r1581183 - in /hadoop/common/trunk/hadoop-common-project/hadoop-common: ./ src/main/java/org/apache/hadoop/fs/ src/main/java/org/apache/hadoop/fs/viewfs/ src/test/java/org/apache/hadoop/fs/

Author: szetszwo
Date: Tue Mar 25 02:03:07 2014
New Revision: 1581183

URL: http://svn.apache.org/r1581183
Log:
HADOOP-10425. LocalFileSystem.getContentSummary should not count crc files.

Modified:
    hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFileSystem.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFileSystem.java

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1581183&r1=1581182&r2=1581183&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt Tue Mar 25 02:03:07 2014
@@ -444,6 +444,9 @@ Release 2.4.0 - UNRELEASED
 
     HADOOP-10422. Remove redundant logging of RPC retry attempts. (cnauroth)
 
+    HADOOP-10425. LocalFileSystem.getContentSummary should not count crc files.
+    (szetszwo)
+
   BREAKDOWN OF HADOOP-10184 SUBTASKS AND RELATED JIRAS
 
     HADOOP-10185. FileSystem API for ACLs. (cnauroth)

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java?rev=1581183&r1=1581182&r2=1581183&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java (original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java Tue Mar 25 02:03:07 2014
@@ -375,11 +375,6 @@ public class FilterFileSystem extends Fi
 
   // path variants delegate to underlying filesystem 
   @Override
-  public ContentSummary getContentSummary(Path f) throws IOException {
-    return fs.getContentSummary(f);
-  }
-
-  @Override
   public long getDefaultBlockSize(Path f) {
     return fs.getDefaultBlockSize(f);
   }

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFileSystem.java?rev=1581183&r1=1581182&r2=1581183&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFileSystem.java (original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFileSystem.java Tue Mar 25 02:03:07 2014
@@ -320,7 +320,7 @@ class ChRootedFileSystem extends FilterF
 
   @Override
   public ContentSummary getContentSummary(Path f) throws IOException {
-    return super.getContentSummary(fullPath(f));
+    return fs.getContentSummary(fullPath(f));
   }
   
 

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFileSystem.java?rev=1581183&r1=1581182&r2=1581183&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFileSystem.java (original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFileSystem.java Tue Mar 25 02:03:07 2014
@@ -34,6 +34,7 @@ import static org.junit.Assert.*;
 import static org.junit.Assume.assumeTrue;
 
 import org.junit.After;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -204,12 +205,22 @@ public class TestLocalFileSystem {
   }
   
   @Test(timeout = 1000)
-  public void testMkdirs() throws IOException {
+  public void testCreateFileAndMkdirs() throws IOException {
     Path test_dir = new Path(TEST_ROOT_DIR, "test_dir");
-    Path test_file = new Path(TEST_ROOT_DIR, "file1");
+    Path test_file = new Path(test_dir, "file1");
     assertTrue(fileSys.mkdirs(test_dir));
    
-    writeFile(fileSys, test_file, 1);
+    final int fileSize = new Random().nextInt(1 << 20) + 1;
+    writeFile(fileSys, test_file, fileSize);
+
+    {
+      //check FileStatus and ContentSummary 
+      final FileStatus status = fileSys.getFileStatus(test_file);
+      Assert.assertEquals(fileSize, status.getLen());
+      final ContentSummary summary = fileSys.getContentSummary(test_dir);
+      Assert.assertEquals(fileSize, summary.getLength());
+    }
+    
     // creating dir over a file
     Path bad_dir = new Path(test_file, "another_dir");