hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ji...@apache.org
Subject hadoop git commit: HDFS-8867. Enable optimized block reports. Contributed by Daryn Sharp.
Date Wed, 19 Aug 2015 17:42:44 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2.7 7409ed783 -> 4c005a4e1


HDFS-8867. Enable optimized block reports. Contributed by Daryn Sharp.

(cherry picked from commit f61120d964a609ae5eabeb5c4d6c9afe0a15cad8)
(cherry picked from commit c0a4cd978a9142a1fb9f6367d9af0dc7f0e711d9)


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

Branch: refs/heads/branch-2.7
Commit: 4c005a4e164d47596c4c95363b3f52375b6487f9
Parents: 7409ed7
Author: Jing Zhao <jing9@apache.org>
Authored: Wed Aug 19 10:36:56 2015 -0700
Committer: Jing Zhao <jing9@apache.org>
Committed: Wed Aug 19 10:41:30 2015 -0700

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt        |  2 ++
 .../hadoop/hdfs/server/protocol/NamespaceInfo.java | 17 +++++++++++++----
 .../hadoop/hdfs/protocol/TestBlockListAsLongs.java |  9 ++++++++-
 3 files changed, 23 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/4c005a4e/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 0f9d0c7..a8ab37f 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -25,6 +25,8 @@ Release 2.7.2 - UNRELEASED
     HDFS-8852. HDFS architecture documentation of version 2.x is outdated
     about append write support. (Ajith S via aajisaka)
 
+    HDFS-8867. Enable optimized block reports. (Daryn Sharp via jing9)
+
 Release 2.7.1 - 2015-07-06
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/4c005a4e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/NamespaceInfo.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/NamespaceInfo.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/NamespaceInfo.java
index a7439a0..caca646 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/NamespaceInfo.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/NamespaceInfo.java
@@ -47,18 +47,27 @@ public class NamespaceInfo extends StorageInfo {
 
   // only authoritative on the server-side to determine advertisement to
   // clients.  enum will update the supported values
-  private static long CAPABILITIES_SUPPORTED = 0;
+  private static final long CAPABILITIES_SUPPORTED = getSupportedCapabilities();
+
+  private static long getSupportedCapabilities() {
+    long mask = 0;
+    for (Capability c : Capability.values()) {
+      if (c.supported) {
+        mask |= c.mask;
+      }
+    }
+    return mask;
+  }
 
   public enum Capability {
     UNKNOWN(false),
     STORAGE_BLOCK_REPORT_BUFFERS(true); // use optimized ByteString buffers
+    private final boolean supported;
     private final long mask;
     Capability(boolean isSupported) {
+      supported = isSupported;
       int bits = ordinal() - 1;
       mask = (bits < 0) ? 0 : (1L << bits);
-      if (isSupported) {
-        CAPABILITIES_SUPPORTED |= mask;
-      }
     }
     public long getMask() {
       return mask;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/4c005a4e/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocol/TestBlockListAsLongs.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocol/TestBlockListAsLongs.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocol/TestBlockListAsLongs.java
index f0dab4c..bdb7f86 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocol/TestBlockListAsLongs.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocol/TestBlockListAsLongs.java
@@ -187,7 +187,14 @@ public class TestBlockListAsLongs {
     }
     assertTrue(reportReplicas.isEmpty());
   }
-  
+
+  @Test
+  public void testCapabilitiesInited() {
+    NamespaceInfo nsInfo = new NamespaceInfo();
+    assertTrue(
+        nsInfo.isCapabilitySupported(Capability.STORAGE_BLOCK_REPORT_BUFFERS));
+  }
+
   @Test
   public void testDatanodeDetect() throws ServiceException, IOException {
     final AtomicReference<BlockReportRequestProto> request =


Mime
View raw message