hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kih...@apache.org
Subject hadoop git commit: HDFS-8581. ContentSummary on / skips further counts on yielding lock (contributed by J.Andreina)
Date Tue, 14 Jun 2016 13:25:46 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2.7 d44873a2a -> 8854cdd9e


HDFS-8581. ContentSummary on / skips further counts on yielding lock (contributed by J.Andreina)

(cherry picked from commit 4014ce5990bff9b0ecb3d38a633d40eaf6cf07a7)

Conflicts:
	hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
	hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestQuota.java


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

Branch: refs/heads/branch-2.7
Commit: 8854cdd9eefd05c10d0518528a3bff6a7348f37e
Parents: d44873a
Author: Kihwal Lee <kihwal@apache.org>
Authored: Tue Jun 14 08:25:09 2016 -0500
Committer: Kihwal Lee <kihwal@apache.org>
Committed: Tue Jun 14 08:25:09 2016 -0500

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt     |  4 ++-
 .../hdfs/server/namenode/INodeDirectory.java    |  2 +-
 .../java/org/apache/hadoop/hdfs/TestQuota.java  | 31 ++++++++++++++++++++
 3 files changed, 35 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/8854cdd9/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 26bb1e5..df338df 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -122,7 +122,6 @@ Release 2.7.3 - UNRELEASED
     HDFS-9779 . TestReplicationPolicyWithNodeGroup NODE variable picks wrong rack value
     (Kuhu Shukla via umamahesh)
 
-
     HDFS-9784. Example usage is not correct in Transparent Encryption document.
     (Takashi Ohnishi via aajisaka)
 
@@ -184,6 +183,9 @@ Release 2.7.3 - UNRELEASED
     HDFS-8548. Minicluster throws NPE on shutdown.
     (surendra singh lilhore via xyao)
 
+    HDFS-8581. ContentSummary on / skips further counts on yielding lock
+    (J.Andreina via vinayakumarb)
+
 Release 2.7.2 - 2016-01-25
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8854cdd9/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeDirectory.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeDirectory.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeDirectory.java
index 9f55fc4..b32445a 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeDirectory.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeDirectory.java
@@ -662,7 +662,7 @@ public class INodeDirectory extends INodeWithAdditionalFields
         continue;
       }
       // The locks were released and reacquired. Check parent first.
-      if (getParent() == null) {
+      if (!isRoot() && getParent() == null) {
         // Stop further counting and return whatever we have so far.
         break;
       }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8854cdd9/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestQuota.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestQuota.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestQuota.java
index 6e93a91..6fab668 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestQuota.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestQuota.java
@@ -21,11 +21,13 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import java.io.IOException;
 import java.io.OutputStream;
 import java.security.PrivilegedExceptionAction;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.ContentSummary;
+import org.apache.hadoop.fs.FSDataOutputStream;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hdfs.protocol.DSQuotaExceededException;
@@ -921,4 +923,33 @@ public class TestQuota {
       cluster.shutdown();
     }
   }
+
+   /**
+   * File count on root , should return total value of files in Filesystem
+   * when one folder contains files more than "dfs.content-summary.limit".
+   */
+  @Test
+  public void testHugeFileCount() throws IOException {
+    MiniDFSCluster cluster = null;
+    Configuration conf = new Configuration();
+    conf.setInt("dfs.content-summary.limit", 4);
+    try {
+      cluster = new MiniDFSCluster.Builder(conf).numDataNodes(0).build();
+      DistributedFileSystem dfs = cluster.getFileSystem();
+      for (int i = 1; i <= 5; i++) {
+        FSDataOutputStream out =
+            dfs.create(new Path("/Folder1/" + "file" + i),(short)1);
+        out.close();
+      }
+      FSDataOutputStream out = dfs.create(new Path("/Folder2/file6"),(short)1);
+      out.close();
+      ContentSummary contentSummary = dfs.getContentSummary(new Path("/"));
+      assertEquals(6, contentSummary.getFileCount());
+    } finally {
+      if (cluster != null) {
+        cluster.shutdown();
+        cluster = null;
+      }
+    }
+  }
 }


---------------------------------------------------------------------
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