[33/48] hadoop git commit: HDFS-9005. Provide support for upgrade domain script. (Ming Ma via Lei Xu)

2016-03-28 Thread aengineer
HDFS-9005. Provide support for upgrade domain script. (Ming Ma via Lei Xu)


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

Branch: refs/heads/HDFS-7240
Commit: 4fcfea71bfb16295f3a661e712d66351a1edc55e
Parents: 9a09200
Author: Lei Xu 
Authored: Fri Mar 25 17:09:12 2016 -0700
Committer: Lei Xu 
Committed: Fri Mar 25 17:09:12 2016 -0700

--
 .../hdfs/protocol/DatanodeAdminProperties.java  | 100 
 .../hdfs/util/CombinedHostsFileReader.java  |  76 ++
 .../hdfs/util/CombinedHostsFileWriter.java  |  69 +
 .../CombinedHostFileManager.java| 250 +++
 .../blockmanagement/HostConfigManager.java  |  80 ++
 .../hdfs/server/blockmanagement/HostSet.java| 114 +
 .../TestUpgradeDomainBlockPlacementPolicy.java  | 169 +
 .../hadoop/hdfs/util/HostsFileWriter.java   | 122 +
 .../hdfs/util/TestCombinedHostsFileReader.java  |  79 ++
 .../src/test/resources/dfs.hosts.json   |   5 +
 10 files changed, 1064 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/4fcfea71/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeAdminProperties.java
--
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeAdminProperties.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeAdminProperties.java
new file mode 100644
index 000..9f7b983
--- /dev/null
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeAdminProperties.java
@@ -0,0 +1,100 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hdfs.protocol;
+
+import org.apache.hadoop.hdfs.protocol.DatanodeInfo.AdminStates;
+
+/**
+ * The class describes the configured admin properties for a datanode.
+ *
+ * It is the static configuration specified by administrators via dfsadmin
+ * command; different from the runtime state. CombinedHostFileManager uses
+ * the class to deserialize the configurations from json-based file format.
+ *
+ * To decommission a node, use AdminStates.DECOMMISSIONED.
+ */
+public class DatanodeAdminProperties {
+  private String hostName;
+  private int port;
+  private String upgradeDomain;
+  private AdminStates adminState = AdminStates.NORMAL;
+
+  /**
+   * Return the host name of the datanode.
+   * @return the host name of the datanode.
+   */
+  public String getHostName() {
+return hostName;
+  }
+
+  /**
+   * Set the host name of the datanode.
+   * @param hostName the host name of the datanode.
+   */
+  public void setHostName(final String hostName) {
+this.hostName = hostName;
+  }
+
+  /**
+   * Get the port number of the datanode.
+   * @return the port number of the datanode.
+   */
+  public int getPort() {
+return port;
+  }
+
+  /**
+   * Set the port number of the datanode.
+   * @param port the port number of the datanode.
+   */
+  public void setPort(final int port) {
+this.port = port;
+  }
+
+  /**
+   * Get the upgrade domain of the datanode.
+   * @return the upgrade domain of the datanode.
+   */
+  public String getUpgradeDomain() {
+return upgradeDomain;
+  }
+
+  /**
+   * Set the upgrade domain of the datanode.
+   * @param upgradeDomain the upgrade domain of the datanode.
+   */
+  public void setUpgradeDomain(final String upgradeDomain) {
+this.upgradeDomain = upgradeDomain;
+  }
+
+  /**
+   * Get the admin state of the datanode.
+   * @return the admin state of the datanode.
+   */
+  public AdminStates getAdminState() {
+return adminState;
+  }
+
+  /**
+   * Set the admin state of the datanode.
+   * @param adminState the admin state of the datanode.
+   */
+  

[1/2] hadoop git commit: HDFS-9005. Provide support for upgrade domain script. (Ming Ma via Lei Xu)

2016-03-25 Thread lei
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 5e823d839 -> ae9831498


HDFS-9005. Provide support for upgrade domain script. (Ming Ma via Lei Xu)


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

Branch: refs/heads/branch-2
Commit: 493648611de79ba7a36fe39c0494c63b4d60546f
Parents: 5e823d8
Author: Lei Xu 
Authored: Fri Mar 25 17:09:12 2016 -0700
Committer: Lei Xu 
Committed: Fri Mar 25 17:12:44 2016 -0700

--
 .../hdfs/protocol/DatanodeAdminProperties.java  | 100 
 .../hdfs/util/CombinedHostsFileReader.java  |  76 ++
 .../hdfs/util/CombinedHostsFileWriter.java  |  69 +
 .../CombinedHostFileManager.java| 250 +++
 .../blockmanagement/HostConfigManager.java  |  80 ++
 .../hdfs/server/blockmanagement/HostSet.java| 114 +
 .../TestUpgradeDomainBlockPlacementPolicy.java  | 169 +
 .../hadoop/hdfs/util/HostsFileWriter.java   | 122 +
 .../hdfs/util/TestCombinedHostsFileReader.java  |  79 ++
 .../src/test/resources/dfs.hosts.json   |   5 +
 10 files changed, 1064 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/49364861/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeAdminProperties.java
--
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeAdminProperties.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeAdminProperties.java
new file mode 100644
index 000..9f7b983
--- /dev/null
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeAdminProperties.java
@@ -0,0 +1,100 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hdfs.protocol;
+
+import org.apache.hadoop.hdfs.protocol.DatanodeInfo.AdminStates;
+
+/**
+ * The class describes the configured admin properties for a datanode.
+ *
+ * It is the static configuration specified by administrators via dfsadmin
+ * command; different from the runtime state. CombinedHostFileManager uses
+ * the class to deserialize the configurations from json-based file format.
+ *
+ * To decommission a node, use AdminStates.DECOMMISSIONED.
+ */
+public class DatanodeAdminProperties {
+  private String hostName;
+  private int port;
+  private String upgradeDomain;
+  private AdminStates adminState = AdminStates.NORMAL;
+
+  /**
+   * Return the host name of the datanode.
+   * @return the host name of the datanode.
+   */
+  public String getHostName() {
+return hostName;
+  }
+
+  /**
+   * Set the host name of the datanode.
+   * @param hostName the host name of the datanode.
+   */
+  public void setHostName(final String hostName) {
+this.hostName = hostName;
+  }
+
+  /**
+   * Get the port number of the datanode.
+   * @return the port number of the datanode.
+   */
+  public int getPort() {
+return port;
+  }
+
+  /**
+   * Set the port number of the datanode.
+   * @param port the port number of the datanode.
+   */
+  public void setPort(final int port) {
+this.port = port;
+  }
+
+  /**
+   * Get the upgrade domain of the datanode.
+   * @return the upgrade domain of the datanode.
+   */
+  public String getUpgradeDomain() {
+return upgradeDomain;
+  }
+
+  /**
+   * Set the upgrade domain of the datanode.
+   * @param upgradeDomain the upgrade domain of the datanode.
+   */
+  public void setUpgradeDomain(final String upgradeDomain) {
+this.upgradeDomain = upgradeDomain;
+  }
+
+  /**
+   * Get the admin state of the datanode.
+   * @return the admin state of the datanode.
+   */
+  public AdminStates getAdminState() {
+return adminState;
+  }
+
+  /**
+   * Set the admin state 

hadoop git commit: HDFS-9005. Provide support for upgrade domain script. (Ming Ma via Lei Xu)

2016-03-25 Thread lei
Repository: hadoop
Updated Branches:
  refs/heads/trunk 9a09200a1 -> 4fcfea71b


HDFS-9005. Provide support for upgrade domain script. (Ming Ma via Lei Xu)


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

Branch: refs/heads/trunk
Commit: 4fcfea71bfb16295f3a661e712d66351a1edc55e
Parents: 9a09200
Author: Lei Xu 
Authored: Fri Mar 25 17:09:12 2016 -0700
Committer: Lei Xu 
Committed: Fri Mar 25 17:09:12 2016 -0700

--
 .../hdfs/protocol/DatanodeAdminProperties.java  | 100 
 .../hdfs/util/CombinedHostsFileReader.java  |  76 ++
 .../hdfs/util/CombinedHostsFileWriter.java  |  69 +
 .../CombinedHostFileManager.java| 250 +++
 .../blockmanagement/HostConfigManager.java  |  80 ++
 .../hdfs/server/blockmanagement/HostSet.java| 114 +
 .../TestUpgradeDomainBlockPlacementPolicy.java  | 169 +
 .../hadoop/hdfs/util/HostsFileWriter.java   | 122 +
 .../hdfs/util/TestCombinedHostsFileReader.java  |  79 ++
 .../src/test/resources/dfs.hosts.json   |   5 +
 10 files changed, 1064 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/4fcfea71/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeAdminProperties.java
--
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeAdminProperties.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeAdminProperties.java
new file mode 100644
index 000..9f7b983
--- /dev/null
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeAdminProperties.java
@@ -0,0 +1,100 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hdfs.protocol;
+
+import org.apache.hadoop.hdfs.protocol.DatanodeInfo.AdminStates;
+
+/**
+ * The class describes the configured admin properties for a datanode.
+ *
+ * It is the static configuration specified by administrators via dfsadmin
+ * command; different from the runtime state. CombinedHostFileManager uses
+ * the class to deserialize the configurations from json-based file format.
+ *
+ * To decommission a node, use AdminStates.DECOMMISSIONED.
+ */
+public class DatanodeAdminProperties {
+  private String hostName;
+  private int port;
+  private String upgradeDomain;
+  private AdminStates adminState = AdminStates.NORMAL;
+
+  /**
+   * Return the host name of the datanode.
+   * @return the host name of the datanode.
+   */
+  public String getHostName() {
+return hostName;
+  }
+
+  /**
+   * Set the host name of the datanode.
+   * @param hostName the host name of the datanode.
+   */
+  public void setHostName(final String hostName) {
+this.hostName = hostName;
+  }
+
+  /**
+   * Get the port number of the datanode.
+   * @return the port number of the datanode.
+   */
+  public int getPort() {
+return port;
+  }
+
+  /**
+   * Set the port number of the datanode.
+   * @param port the port number of the datanode.
+   */
+  public void setPort(final int port) {
+this.port = port;
+  }
+
+  /**
+   * Get the upgrade domain of the datanode.
+   * @return the upgrade domain of the datanode.
+   */
+  public String getUpgradeDomain() {
+return upgradeDomain;
+  }
+
+  /**
+   * Set the upgrade domain of the datanode.
+   * @param upgradeDomain the upgrade domain of the datanode.
+   */
+  public void setUpgradeDomain(final String upgradeDomain) {
+this.upgradeDomain = upgradeDomain;
+  }
+
+  /**
+   * Get the admin state of the datanode.
+   * @return the admin state of the datanode.
+   */
+  public AdminStates getAdminState() {
+return adminState;
+  }
+
+  /**
+   * Set the admin state of the