hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject hadoop git commit: HDFS-7240. Introduce STORAGE_CONTAINER_SERVICE as a new NodeType. (Contributed by Arpit Agarwal)
Date Mon, 15 Jun 2015 18:06:41 GMT
Repository: hadoop
Updated Branches:
  refs/heads/HDFS-7240 e721a39e2 -> 1f32463ba


HDFS-7240. Introduce STORAGE_CONTAINER_SERVICE as a new NodeType. (Contributed by Arpit Agarwal)


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

Branch: refs/heads/HDFS-7240
Commit: 1f32463baaef0efc4fcdf4597b1080337596d3c3
Parents: e721a39
Author: Arpit Agarwal <arp@apache.org>
Authored: Mon Jun 15 11:04:02 2015 -0700
Committer: Arpit Agarwal <arp@apache.org>
Committed: Mon Jun 15 11:04:02 2015 -0700

----------------------------------------------------------------------
 .../hadoop-hdfs/CHANGES-HDFS-7240.txt           |  3 ++
 .../apache/hadoop/hdfs/protocolPB/PBHelper.java | 39 +++++++++++++++++++-
 .../hdfs/server/common/HdfsServerConstants.java |  3 +-
 .../hdfs/server/protocol/NamespaceInfo.java     | 22 ++++++++---
 .../StorageContainerManager.java                |  4 +-
 .../hadoop-hdfs/src/main/proto/hdfs.proto       |  8 ++++
 6 files changed, 70 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/1f32463b/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-7240.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-7240.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-7240.txt
index a98d407..71a1ec8 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-7240.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-7240.txt
@@ -4,3 +4,6 @@
 
     HDFS-8392. Ozone: DataNode support for multiple datasets. (Arpit Agarwal)
 
+    HDFS-8456. Ozone: Introduce STORAGE_CONTAINER_SERVICE as a new NodeType.
+    (Arpit Agarwal)
+

http://git-wip-us.apache.org/repos/asf/hadoop/blob/1f32463b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelper.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelper.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelper.java
index c9a9c33..9f451ec 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelper.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelper.java
@@ -353,7 +353,8 @@ public class PBHelper {
   public static StorageInfoProto convert(StorageInfo info) {
     return StorageInfoProto.newBuilder().setClusterID(info.getClusterID())
         .setCTime(info.getCTime()).setLayoutVersion(info.getLayoutVersion())
-        .setNamespceID(info.getNamespaceID()).build();
+        .setNamespceID(info.getNamespaceID())
+        .setNodeType(convert(info.getNodeType())).build();
   }
 
   public static StorageInfo convert(StorageInfoProto info, NodeType type) {
@@ -572,9 +573,43 @@ public class PBHelper {
 
   public static NamespaceInfo convert(NamespaceInfoProto info) {
     StorageInfoProto storage = info.getStorageInfo();
+
+    // The default node type must be NAME_NODE for wire compatibility.
     return new NamespaceInfo(storage.getNamespceID(), storage.getClusterID(),
         info.getBlockPoolID(), storage.getCTime(), info.getBuildVersion(),
-        info.getSoftwareVersion(), info.getCapabilities());
+        info.getSoftwareVersion(),
+        storage.hasNodeType() ? convert(storage.getNodeType()) : NodeType.NAME_NODE,
+        info.getCapabilities());
+  }
+
+  public static NodeType convert(StorageInfoProto.NodeTypeProto nodeType) {
+    switch(nodeType) {
+    case NAME_NODE:
+      return NodeType.NAME_NODE;
+    case DATA_NODE:
+      return NodeType.DATA_NODE;
+    case JOURNAL_NODE:
+      return NodeType.JOURNAL_NODE;
+    case STORAGE_CONTAINER_SERVICE:
+      return NodeType.STORAGE_CONTAINER_SERVICE;
+    default:
+      throw new IllegalArgumentException("Unrecognized NodeType " + nodeType);
+    }
+  }
+
+  public static StorageInfoProto.NodeTypeProto convert(NodeType nodeType) {
+    switch(nodeType) {
+    case NAME_NODE:
+      return StorageInfoProto.NodeTypeProto.NAME_NODE;
+    case DATA_NODE:
+      return StorageInfoProto.NodeTypeProto.DATA_NODE;
+    case JOURNAL_NODE:
+      return StorageInfoProto.NodeTypeProto.JOURNAL_NODE;
+    case STORAGE_CONTAINER_SERVICE:
+      return StorageInfoProto.NodeTypeProto.STORAGE_CONTAINER_SERVICE;
+    default:
+      throw new IllegalArgumentException("Unrecognized NodeType " + nodeType);
+    }
   }
 
   public static NamenodeCommand convert(NamenodeCommandProto cmd) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/1f32463b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java
index 26a7ab3..de732a6 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java
@@ -115,7 +115,8 @@ public interface HdfsServerConstants {
   enum NodeType {
     NAME_NODE,
     DATA_NODE,
-    JOURNAL_NODE
+    JOURNAL_NODE,
+    STORAGE_CONTAINER_SERVICE
   }
 
   /** Startup options for rolling upgrade. */

http://git-wip-us.apache.org/repos/asf/hadoop/blob/1f32463b/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 dfdf449..b0507d2 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
@@ -67,7 +67,12 @@ public class NamespaceInfo extends StorageInfo {
 
   // defaults to enabled capabilites since this ctor is for server
   public NamespaceInfo() {
-    super(NodeType.NAME_NODE);
+    this(NodeType.NAME_NODE);
+  }
+
+  // defaults to enabled capabilites since this ctor is for server
+  public NamespaceInfo(NodeType nodeType) {
+    super(nodeType);
     buildVersion = null;
     capabilities = CAPABILITIES_SUPPORTED;
   }
@@ -75,16 +80,17 @@ public class NamespaceInfo extends StorageInfo {
   // defaults to enabled capabilites since this ctor is for server
   public NamespaceInfo(int nsID, String clusterID, String bpID,
       long cT, String buildVersion, String softwareVersion) {
-    this(nsID, clusterID, bpID, cT, buildVersion, softwareVersion,
-        CAPABILITIES_SUPPORTED);
+    this(nsID, clusterID, bpID, cT, buildVersion,
+         softwareVersion, NodeType.NAME_NODE,
+         CAPABILITIES_SUPPORTED);
   }
 
   // for use by server and/or client
   public NamespaceInfo(int nsID, String clusterID, String bpID,
       long cT, String buildVersion, String softwareVersion,
-      long capabilities) {
+      NodeType nodeType, long capabilities) {
     super(HdfsServerConstants.NAMENODE_LAYOUT_VERSION, nsID, clusterID, cT,
-        NodeType.NAME_NODE);
+        nodeType);
     blockPoolID = bpID;
     this.buildVersion = buildVersion;
     this.softwareVersion = softwareVersion;
@@ -96,6 +102,12 @@ public class NamespaceInfo extends StorageInfo {
     this(nsID, clusterID, bpID, cT, Storage.getBuildVersion(),
         VersionInfo.getVersion());
   }
+
+  public NamespaceInfo(int nsID, String clusterID, String bpID,
+                       long cT, NodeType nodeType) {
+    this(nsID, clusterID, bpID, cT, Storage.getBuildVersion(),
+         VersionInfo.getVersion(), nodeType, CAPABILITIES_SUPPORTED);
+  }
   
   public long getCapabilities() {
     return capabilities;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/1f32463b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/storagecontainer/StorageContainerManager.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/storagecontainer/StorageContainerManager.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/storagecontainer/StorageContainerManager.java
index cce9507..06b99a8 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/storagecontainer/StorageContainerManager.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/storagecontainer/StorageContainerManager.java
@@ -27,6 +27,7 @@ import org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolPB;
 import org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolServerSideTranslatorPB;
 import org.apache.hadoop.hdfs.server.blockmanagement.BlockManager;
 import org.apache.hadoop.hdfs.server.blockmanagement.BlocksMap;
+import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.NodeType;
 import org.apache.hadoop.hdfs.server.namenode.NameNode;
 import org.apache.hadoop.hdfs.server.namenode.Namesystem;
 import org.apache.hadoop.hdfs.server.protocol.*;
@@ -253,7 +254,8 @@ public class StorageContainerManager
   }
 
   private NamespaceInfo unprotectedGetNamespaceInfo() {
-    return new NamespaceInfo(1, "random", "random", 2);
+    return new NamespaceInfo(1, "random", "random", 2,
+        NodeType.STORAGE_CONTAINER_SERVICE);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/hadoop/blob/1f32463b/hadoop-hdfs-project/hadoop-hdfs/src/main/proto/hdfs.proto
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/proto/hdfs.proto b/hadoop-hdfs-project/hadoop-hdfs/src/main/proto/hdfs.proto
index 86fb462..2df5955 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/proto/hdfs.proto
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/proto/hdfs.proto
@@ -421,6 +421,14 @@ message StorageInfoProto {
   required uint32 namespceID = 2;    // File system namespace ID
   required string clusterID = 3;     // ID of the cluster
   required uint64 cTime = 4;         // File system creation time
+
+  enum NodeTypeProto {
+    NAME_NODE = 1;
+    DATA_NODE = 2;
+    JOURNAL_NODE = 3;
+    STORAGE_CONTAINER_SERVICE = 4;
+  }
+  optional NodeTypeProto nodeType = 5;
 }
 
 /**


Mime
View raw message