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 vi...@apache.org on 2018/07/09 18:26:06 UTC

[14/50] [abbrv] hadoop git commit: HDDS-212. Introduce NodeStateManager to manage the state of Datanodes in SCM. Contributed by Nanda kumar.

http://git-wip-us.apache.org/repos/asf/hadoop/blob/71df8c27/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/states/NodeStateMap.java
----------------------------------------------------------------------
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/states/NodeStateMap.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/states/NodeStateMap.java
new file mode 100644
index 0000000..dd91866
--- /dev/null
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/states/NodeStateMap.java
@@ -0,0 +1,281 @@
+/**
+ * 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.hdds.scm.node.states;
+
+import org.apache.hadoop.hdds.protocol.DatanodeDetails;
+import org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeState;
+import org.apache.hadoop.hdds.scm.node.DatanodeInfo;
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+/**
+ * Maintains the state of datanodes in SCM. This class should only be used by
+ * NodeStateManager to maintain the state. If anyone wants to change the
+ * state of a node they should call NodeStateManager, do not directly use
+ * this class.
+ */
+public class NodeStateMap {
+
+  /**
+   * Node id to node info map.
+   */
+  private final ConcurrentHashMap<UUID, DatanodeInfo> nodeMap;
+  /**
+   * Represents the current state of node.
+   */
+  private final ConcurrentHashMap<NodeState, Set<UUID>> stateMap;
+  private final ReadWriteLock lock;
+
+  /**
+   * Creates a new instance of NodeStateMap with no nodes.
+   */
+  public NodeStateMap() {
+    lock = new ReentrantReadWriteLock();
+    nodeMap = new ConcurrentHashMap<>();
+    stateMap = new ConcurrentHashMap<>();
+    initStateMap();
+  }
+
+  /**
+   * Initializes the state map with available states.
+   */
+  private void initStateMap() {
+    for (NodeState state : NodeState.values()) {
+      stateMap.put(state, new HashSet<>());
+    }
+  }
+
+  /**
+   * Adds a node to NodeStateMap.
+   *
+   * @param datanodeDetails DatanodeDetails
+   * @param nodeState initial NodeState
+   *
+   * @throws NodeAlreadyExistsException if the node already exist
+   */
+  public void addNode(DatanodeDetails datanodeDetails, NodeState nodeState)
+      throws NodeAlreadyExistsException {
+    lock.writeLock().lock();
+    try {
+      UUID id = datanodeDetails.getUuid();
+      if (nodeMap.containsKey(id)) {
+        throw new NodeAlreadyExistsException("Node UUID: " + id);
+      }
+      nodeMap.put(id, new DatanodeInfo(datanodeDetails));
+      stateMap.get(nodeState).add(id);
+    } finally {
+      lock.writeLock().unlock();
+    }
+  }
+
+  /**
+   * Updates the node state.
+   *
+   * @param nodeId Node Id
+   * @param currentState current state
+   * @param newState new state
+   *
+   * @throws NodeNotFoundException if the node is not present
+   */
+  public void updateNodeState(UUID nodeId, NodeState currentState,
+                              NodeState newState)throws NodeNotFoundException {
+    lock.writeLock().lock();
+    try {
+      if (stateMap.get(currentState).remove(nodeId)) {
+        stateMap.get(newState).add(nodeId);
+      } else {
+        throw new NodeNotFoundException("Node UUID: " + nodeId +
+            ", not found in state: " + currentState);
+      }
+    } finally {
+      lock.writeLock().unlock();
+    }
+  }
+
+  /**
+   * Returns DatanodeDetails for the given node id.
+   *
+   * @param uuid Node Id
+   *
+   * @return DatanodeDetails of the node
+   *
+   * @throws NodeNotFoundException if the node is not present
+   */
+  public DatanodeDetails getNodeDetails(UUID uuid)
+      throws NodeNotFoundException {
+    return getNodeInfo(uuid);
+  }
+
+  /**
+   * Returns DatanodeInfo for the given node id.
+   *
+   * @param uuid Node Id
+   *
+   * @return DatanodeInfo of the node
+   *
+   * @throws NodeNotFoundException if the node is not present
+   */
+  public DatanodeInfo getNodeInfo(UUID uuid) throws NodeNotFoundException {
+    lock.readLock().lock();
+    try {
+      if (nodeMap.containsKey(uuid)) {
+        return nodeMap.get(uuid);
+      }
+      throw new NodeNotFoundException("Node UUID: " + uuid);
+    } finally {
+      lock.readLock().unlock();
+    }
+  }
+
+
+  /**
+   * Returns the list of node ids which are in the specified state.
+   *
+   * @param state NodeState
+   *
+   * @return list of node ids
+   */
+  public List<UUID> getNodes(NodeState state) {
+    lock.readLock().lock();
+    try {
+      return new LinkedList<>(stateMap.get(state));
+    } finally {
+      lock.readLock().unlock();
+    }
+  }
+
+  /**
+   * Returns the list of all the node ids.
+   *
+   * @return list of all the node ids
+   */
+  public List<UUID> getAllNodes() {
+    lock.readLock().lock();
+    try {
+      return new LinkedList<>(nodeMap.keySet());
+    } finally {
+      lock.readLock().unlock();
+    }
+  }
+
+  /**
+   * Returns the count of nodes in the specified state.
+   *
+   * @param state NodeState
+   *
+   * @return Number of nodes in the specified state
+   */
+  public int getNodeCount(NodeState state) {
+    lock.readLock().lock();
+    try {
+      return stateMap.get(state).size();
+    } finally {
+      lock.readLock().unlock();
+    }
+  }
+
+  /**
+   * Returns the total node count.
+   *
+   * @return node count
+   */
+  public int getTotalNodeCount() {
+    lock.readLock().lock();
+    try {
+      return nodeMap.size();
+    } finally {
+      lock.readLock().unlock();
+    }
+  }
+
+  /**
+   * Returns the current state of the node.
+   *
+   * @param uuid node id
+   *
+   * @return NodeState
+   *
+   * @throws NodeNotFoundException if the node is not found
+   */
+  public NodeState getNodeState(UUID uuid) throws NodeNotFoundException {
+    lock.readLock().lock();
+    try {
+      for (Map.Entry<NodeState, Set<UUID>> entry : stateMap.entrySet()) {
+        if (entry.getValue().contains(uuid)) {
+          return entry.getKey();
+        }
+      }
+      throw new NodeNotFoundException("Node UUID: " + uuid);
+    } finally {
+      lock.readLock().unlock();
+    }
+  }
+
+  /**
+   * Removes the node from NodeStateMap.
+   *
+   * @param uuid node id
+   *
+   * @throws NodeNotFoundException if the node is not found
+   */
+  public void removeNode(UUID uuid) throws NodeNotFoundException {
+    lock.writeLock().lock();
+    try {
+      if (nodeMap.containsKey(uuid)) {
+        for (Map.Entry<NodeState, Set<UUID>> entry : stateMap.entrySet()) {
+          if(entry.getValue().remove(uuid)) {
+            break;
+          }
+          nodeMap.remove(uuid);
+        }
+        throw new NodeNotFoundException("Node UUID: " + uuid);
+      }
+    } finally {
+      lock.writeLock().unlock();
+    }
+  }
+
+  /**
+   * Since we don't hold a global lock while constructing this string,
+   * the result might be inconsistent. If someone has changed the state of node
+   * while we are constructing the string, the result will be inconsistent.
+   * This should only be used for logging. We should not parse this string and
+   * use it for any critical calculations.
+   *
+   * @return current state of NodeStateMap
+   */
+  @Override
+  public String toString() {
+    StringBuilder builder = new StringBuilder();
+    builder.append("Total number of nodes: ").append(getTotalNodeCount());
+    for (NodeState state : NodeState.values()) {
+      builder.append("Number of nodes in ").append(state).append(" state: ")
+          .append(getNodeCount(state));
+    }
+    return builder.toString();
+  }
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/71df8c27/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
----------------------------------------------------------------------
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
index e1d478f..aefcf1b 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
@@ -47,7 +47,7 @@ import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 import java.net.InetSocketAddress;
-import java.util.EnumSet;
+import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
@@ -188,27 +188,21 @@ public class SCMClientProtocolServer implements
   }
 
   @Override
-  public HddsProtos.NodePool queryNode(EnumSet<HddsProtos.NodeState>
-      nodeStatuses, HddsProtos.QueryScope queryScope, String poolName) throws
+  public List<HddsProtos.Node> queryNode(HddsProtos.NodeState state,
+      HddsProtos.QueryScope queryScope, String poolName) throws
       IOException {
 
     if (queryScope == HddsProtos.QueryScope.POOL) {
       throw new IllegalArgumentException("Not Supported yet");
     }
 
-    List<DatanodeDetails> datanodes = queryNode(nodeStatuses);
-    HddsProtos.NodePool.Builder poolBuilder = HddsProtos.NodePool.newBuilder();
+    List<HddsProtos.Node> result = new ArrayList<>();
+    queryNode(state).forEach(node -> result.add(HddsProtos.Node.newBuilder()
+        .setNodeID(node.getProtoBufMessage())
+        .addNodeStates(state)
+        .build()));
 
-    for (DatanodeDetails datanode : datanodes) {
-      HddsProtos.Node node =
-          HddsProtos.Node.newBuilder()
-              .setNodeID(datanode.getProtoBufMessage())
-              .addAllNodeStates(nodeStatuses)
-              .build();
-      poolBuilder.addNodes(node);
-    }
-
-    return poolBuilder.build();
+    return result;
 
   }
 
@@ -282,35 +276,12 @@ public class SCMClientProtocolServer implements
    * operation between the
    * operators.
    *
-   * @param nodeStatuses - A set of NodeStates.
+   * @param state - NodeStates.
    * @return List of Datanodes.
    */
-  public List<DatanodeDetails> queryNode(EnumSet<HddsProtos.NodeState>
-      nodeStatuses) {
-    Preconditions.checkNotNull(nodeStatuses, "Node Query set cannot be null");
-    Preconditions.checkState(nodeStatuses.size() > 0, "No valid arguments " +
-        "in the query set");
-    List<DatanodeDetails> resultList = new LinkedList<>();
-    Set<DatanodeDetails> currentSet = new TreeSet<>();
-
-    for (HddsProtos.NodeState nodeState : nodeStatuses) {
-      Set<DatanodeDetails> nextSet = queryNodeState(nodeState);
-      if ((nextSet == null) || (nextSet.size() == 0)) {
-        // Right now we only support AND operation. So intersect with
-        // any empty set is null.
-        return resultList;
-      }
-      // First time we have to add all the elements, next time we have to
-      // do an intersection operation on the set.
-      if (currentSet.size() == 0) {
-        currentSet.addAll(nextSet);
-      } else {
-        currentSet.retainAll(nextSet);
-      }
-    }
-
-    resultList.addAll(currentSet);
-    return resultList;
+  public List<DatanodeDetails> queryNode(HddsProtos.NodeState state) {
+    Preconditions.checkNotNull(state, "Node Query set cannot be null");
+    return new LinkedList<>(queryNodeState(state));
   }
 
   @VisibleForTesting
@@ -325,11 +296,6 @@ public class SCMClientProtocolServer implements
    * @return Set of Datanodes that match the NodeState.
    */
   private Set<DatanodeDetails> queryNodeState(HddsProtos.NodeState nodeState) {
-    if (nodeState == HddsProtos.NodeState.RAFT_MEMBER || nodeState ==
-        HddsProtos.NodeState
-        .FREE_NODE) {
-      throw new IllegalStateException("Not implemented yet");
-    }
     Set<DatanodeDetails> returnSet = new TreeSet<>();
     List<DatanodeDetails> tmp = scm.getScmNodeManager().getNodes(nodeState);
     if ((tmp != null) && (tmp.size() > 0)) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/71df8c27/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMDatanodeHeartbeatDispatcher.java
----------------------------------------------------------------------
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMDatanodeHeartbeatDispatcher.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMDatanodeHeartbeatDispatcher.java
index 36f10a9..f221584 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMDatanodeHeartbeatDispatcher.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMDatanodeHeartbeatDispatcher.java
@@ -61,7 +61,7 @@ public final class SCMDatanodeHeartbeatDispatcher {
   public void dispatch(SCMHeartbeatRequestProto heartbeat) {
     DatanodeDetails datanodeDetails =
         DatanodeDetails.getFromProtoBuf(heartbeat.getDatanodeDetails());
-
+    // should we dispatch heartbeat through eventPublisher?
     if (heartbeat.hasNodeReport()) {
       eventPublisher.fireEvent(NODE_REPORT,
           new NodeReportFromDatanode(datanodeDetails,

http://git-wip-us.apache.org/repos/asf/hadoop/blob/71df8c27/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMDatanodeProtocolServer.java
----------------------------------------------------------------------
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMDatanodeProtocolServer.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMDatanodeProtocolServer.java
index 56b0719..aef5b03 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMDatanodeProtocolServer.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMDatanodeProtocolServer.java
@@ -223,7 +223,7 @@ public class SCMDatanodeProtocolServer implements
         .getFromProtoBuf(heartbeat.getDatanodeDetails());
     NodeReportProto nodeReport = heartbeat.getNodeReport();
     List<SCMCommand> commands =
-        scm.getScmNodeManager().sendHeartbeat(datanodeDetails, nodeReport);
+        scm.getScmNodeManager().processHeartbeat(datanodeDetails);
     List<SCMCommandProto> cmdResponses = new LinkedList<>();
     for (SCMCommand cmd : commands) {
       cmdResponses.add(getCommandResponse(cmd));

http://git-wip-us.apache.org/repos/asf/hadoop/blob/71df8c27/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/MockNodeManager.java
----------------------------------------------------------------------
diff --git a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/MockNodeManager.java b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/MockNodeManager.java
index 80b5d6e..3357992 100644
--- a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/MockNodeManager.java
+++ b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/MockNodeManager.java
@@ -19,21 +19,18 @@ package org.apache.hadoop.hdds.scm.container;
 import org.apache.hadoop.hdds.scm.container.placement.metrics.SCMNodeMetric;
 import org.apache.hadoop.hdds.scm.container.placement.metrics.SCMNodeStat;
 import org.apache.hadoop.hdds.scm.node.NodeManager;
-import org.apache.hadoop.hdfs.protocol.UnregisteredNodeException;
+import org.apache.hadoop.hdds.scm.node.states.NodeNotFoundException;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import org.apache.hadoop.hdds.protocol.proto
     .StorageContainerDatanodeProtocolProtos.NodeReportProto;
 import org.apache.hadoop.hdds.protocol.proto
-    .StorageContainerDatanodeProtocolProtos.StorageReportProto;
-import org.apache.hadoop.hdds.protocol.proto
     .StorageContainerDatanodeProtocolProtos.SCMVersionRequestProto;
 import org.apache.hadoop.ozone.OzoneConsts;
 import org.apache.hadoop.ozone.protocol.VersionResponse;
 import org.apache.hadoop.ozone.protocol.commands.RegisteredCommand;
 import org.apache.hadoop.ozone.protocol.commands.SCMCommand;
 import org.assertj.core.util.Preconditions;
-import org.mockito.Mockito;
 
 import java.io.IOException;
 import java.util.HashMap;
@@ -130,11 +127,11 @@ public class MockNodeManager implements NodeManager {
    * Removes a data node from the management of this Node Manager.
    *
    * @param node - DataNode.
-   * @throws UnregisteredNodeException
+   * @throws NodeNotFoundException
    */
   @Override
   public void removeNode(DatanodeDetails node)
-      throws UnregisteredNodeException {
+      throws NodeNotFoundException {
 
   }
 
@@ -273,16 +270,6 @@ public class MockNodeManager implements NodeManager {
   }
 
   /**
-   * Used for testing.
-   *
-   * @return true if the HB check is done.
-   */
-  @Override
-  public boolean waitForHeartbeatProcessed() {
-    return false;
-  }
-
-  /**
    * Returns the node state of a specific node.
    *
    * @param dd - DatanodeDetails
@@ -335,21 +322,6 @@ public class MockNodeManager implements NodeManager {
   }
 
   /**
-   * When an object implementing interface <code>Runnable</code> is used to
-   * create a thread, starting the thread causes the object's <code>run</code>
-   * method to be called in that separately executing thread.
-   * <p>
-   * The general contract of the method <code>run</code> is that it may take any
-   * action whatsoever.
-   *
-   * @see Thread#run()
-   */
-  @Override
-  public void run() {
-
-  }
-
-  /**
    * Gets the version info from SCM.
    *
    * @param versionRequest - version Request.
@@ -379,32 +351,10 @@ public class MockNodeManager implements NodeManager {
    * Send heartbeat to indicate the datanode is alive and doing well.
    *
    * @param datanodeDetails - Datanode ID.
-   * @param nodeReport - node report.
    * @return SCMheartbeat response list
    */
   @Override
-  public List<SCMCommand> sendHeartbeat(DatanodeDetails datanodeDetails,
-      NodeReportProto nodeReport) {
-    if ((datanodeDetails != null) && (nodeReport != null) && (nodeReport
-        .getStorageReportCount() > 0)) {
-      SCMNodeStat stat = this.nodeMetricMap.get(datanodeDetails.getUuid());
-
-      long totalCapacity = 0L;
-      long totalRemaining = 0L;
-      long totalScmUsed = 0L;
-      List<StorageReportProto> storageReports = nodeReport
-          .getStorageReportList();
-      for (StorageReportProto report : storageReports) {
-        totalCapacity += report.getCapacity();
-        totalRemaining += report.getRemaining();
-        totalScmUsed += report.getScmUsed();
-      }
-      aggregateStat.subtract(stat);
-      stat.set(totalCapacity, totalScmUsed, totalRemaining);
-      aggregateStat.add(stat);
-      nodeMetricMap.put(datanodeDetails.getUuid(), stat);
-
-    }
+  public List<SCMCommand> processHeartbeat(DatanodeDetails datanodeDetails) {
     return null;
   }
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/71df8c27/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestContainerPlacement.java
----------------------------------------------------------------------
diff --git a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestContainerPlacement.java b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestContainerPlacement.java
index 98b0a28..c6ea2af 100644
--- a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestContainerPlacement.java
+++ b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestContainerPlacement.java
@@ -36,8 +36,8 @@ import org.apache.hadoop.hdds.protocol.proto
     .StorageContainerDatanodeProtocolProtos.StorageReportProto;
 import org.apache.hadoop.ozone.OzoneConfigKeys;
 import org.apache.hadoop.ozone.OzoneConsts;
-import org.apache.hadoop.test.GenericTestUtils;
 import org.apache.hadoop.test.PathUtils;
+import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
@@ -109,6 +109,7 @@ public class TestContainerPlacement {
    * @throws TimeoutException
    */
   @Test
+  @Ignore
   public void testContainerPlacementCapacity() throws IOException,
       InterruptedException, TimeoutException {
     OzoneConfiguration conf = getConf();
@@ -135,12 +136,11 @@ public class TestContainerPlacement {
         String path = testDir.getAbsolutePath() + "/" + id;
         List<StorageReportProto> reports = TestUtils
             .createStorageReport(capacity, used, remaining, path, null, id, 1);
-        nodeManager.sendHeartbeat(datanodeDetails,
-            TestUtils.createNodeReport(reports));
+        nodeManager.processHeartbeat(datanodeDetails);
       }
 
-      GenericTestUtils.waitFor(() -> nodeManager.waitForHeartbeatProcessed(),
-          100, 4 * 1000);
+      //TODO: wait for heartbeat to be processed
+      Thread.sleep(4 * 1000);
       assertEquals(nodeCount, nodeManager.getNodeCount(HEALTHY));
       assertEquals(capacity * nodeCount,
           (long) nodeManager.getStats().getCapacity().get());

http://git-wip-us.apache.org/repos/asf/hadoop/blob/71df8c27/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestNodeManager.java
----------------------------------------------------------------------
diff --git a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestNodeManager.java b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestNodeManager.java
index 824a135..0a4e33d 100644
--- a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestNodeManager.java
+++ b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestNodeManager.java
@@ -41,6 +41,7 @@ import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
@@ -62,8 +63,6 @@ import static org.apache.hadoop.hdds.scm.ScmConfigKeys
 import static org.apache.hadoop.hdds.scm.ScmConfigKeys
     .OZONE_SCM_HEARTBEAT_PROCESS_INTERVAL;
 import static org.apache.hadoop.hdds.scm.ScmConfigKeys
-    .OZONE_SCM_MAX_HB_COUNT_TO_PROCESS;
-import static org.apache.hadoop.hdds.scm.ScmConfigKeys
     .OZONE_SCM_STALENODE_INTERVAL;
 import static org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeState.DEAD;
 import static org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeState
@@ -148,14 +147,11 @@ public class TestNodeManager {
       for (int x = 0; x < nodeManager.getMinimumChillModeNodes(); x++) {
         DatanodeDetails datanodeDetails = TestUtils.getDatanodeDetails(
             nodeManager);
-        nodeManager.sendHeartbeat(datanodeDetails,
-            null);
+        nodeManager.processHeartbeat(datanodeDetails);
       }
 
-      // Wait for 4 seconds max.
-      GenericTestUtils.waitFor(() -> nodeManager.waitForHeartbeatProcessed(),
-          100, 4 * 1000);
-
+      //TODO: wait for heartbeat to be processed
+      Thread.sleep(4 * 1000);
       assertTrue("Heartbeat thread should have picked up the" +
               "scheduled heartbeats and transitioned out of chill mode.",
           nodeManager.isOutOfChillMode());
@@ -174,8 +170,8 @@ public class TestNodeManager {
       InterruptedException, TimeoutException {
 
     try (SCMNodeManager nodeManager = createNodeManager(getConf())) {
-      GenericTestUtils.waitFor(() -> nodeManager.waitForHeartbeatProcessed(),
-          100, 4 * 1000);
+      //TODO: wait for heartbeat to be processed
+      Thread.sleep(4 * 1000);
       assertFalse("No heartbeats, Node manager should have been in" +
           " chill mode.", nodeManager.isOutOfChillMode());
     }
@@ -195,10 +191,9 @@ public class TestNodeManager {
 
       // Need 100 nodes to come out of chill mode, only one node is sending HB.
       nodeManager.setMinimumChillModeNodes(100);
-      nodeManager.sendHeartbeat(TestUtils.getDatanodeDetails(nodeManager),
-          null);
-      GenericTestUtils.waitFor(() -> nodeManager.waitForHeartbeatProcessed(),
-          100, 4 * 1000);
+      nodeManager.processHeartbeat(TestUtils.getDatanodeDetails(nodeManager));
+      //TODO: wait for heartbeat to be processed
+      Thread.sleep(4 * 1000);
       assertFalse("Not enough heartbeat, Node manager should have" +
           "been in chillmode.", nodeManager.isOutOfChillMode());
     }
@@ -223,12 +218,11 @@ public class TestNodeManager {
 
       // Send 10 heartbeat from same node, and assert we never leave chill mode.
       for (int x = 0; x < 10; x++) {
-        nodeManager.sendHeartbeat(datanodeDetails,
-            null);
+        nodeManager.processHeartbeat(datanodeDetails);
       }
 
-      GenericTestUtils.waitFor(() -> nodeManager.waitForHeartbeatProcessed(),
-          100, 4 * 1000);
+      //TODO: wait for heartbeat to be processed
+      Thread.sleep(4 * 1000);
       assertFalse("Not enough nodes have send heartbeat to node" +
           "manager.", nodeManager.isOutOfChillMode());
     }
@@ -254,14 +248,12 @@ public class TestNodeManager {
     nodeManager.close();
 
     // These should never be processed.
-    nodeManager.sendHeartbeat(datanodeDetails,
-        null);
+    nodeManager.processHeartbeat(datanodeDetails);
 
     // Let us just wait for 2 seconds to prove that HBs are not processed.
     Thread.sleep(2 * 1000);
 
-    assertEquals("Assert new HBs were never processed", 0,
-        nodeManager.getLastHBProcessedCount());
+    //TODO: add assertion
   }
 
   /**
@@ -283,8 +275,7 @@ public class TestNodeManager {
     try (SCMNodeManager nodemanager = createNodeManager(conf)) {
       nodemanager.register(datanodeDetails,
           TestUtils.createNodeReport(reports));
-      List<SCMCommand> command = nodemanager.sendHeartbeat(
-          datanodeDetails, null);
+      List<SCMCommand> command = nodemanager.processHeartbeat(datanodeDetails);
       Assert.assertTrue(nodemanager.getAllNodes().contains(datanodeDetails));
       Assert.assertTrue("On regular HB calls, SCM responses a "
           + "datanode with an empty command list", command.isEmpty());
@@ -302,8 +293,7 @@ public class TestNodeManager {
         GenericTestUtils.waitFor(new Supplier<Boolean>() {
           @Override public Boolean get() {
             List<SCMCommand> command =
-                nodemanager.sendHeartbeat(datanodeDetails,
-                    null);
+                nodemanager.processHeartbeat(datanodeDetails);
             return command.size() == 1 && command.get(0).getType()
                 .equals(SCMCommandProto.Type.reregisterCommand);
           }
@@ -334,11 +324,10 @@ public class TestNodeManager {
       for (int x = 0; x < count; x++) {
         DatanodeDetails datanodeDetails = TestUtils.getDatanodeDetails(
             nodeManager);
-        nodeManager.sendHeartbeat(datanodeDetails,
-            null);
+        nodeManager.processHeartbeat(datanodeDetails);
       }
-      GenericTestUtils.waitFor(() -> nodeManager.waitForHeartbeatProcessed(),
-          100, 4 * 1000);
+      //TODO: wait for heartbeat to be processed
+      Thread.sleep(4 * 1000);
       assertEquals(count, nodeManager.getNodeCount(HEALTHY));
     }
   }
@@ -426,19 +415,18 @@ public class TestNodeManager {
       DatanodeDetails staleNode = TestUtils.getDatanodeDetails(nodeManager);
 
       // Heartbeat once
-      nodeManager.sendHeartbeat(staleNode,
-          null);
+      nodeManager.processHeartbeat(staleNode);
 
       // Heartbeat all other nodes.
       for (DatanodeDetails dn : nodeList) {
-        nodeManager.sendHeartbeat(dn, null);
+        nodeManager.processHeartbeat(dn);
       }
 
       // Wait for 2 seconds .. and heartbeat good nodes again.
       Thread.sleep(2 * 1000);
 
       for (DatanodeDetails dn : nodeList) {
-        nodeManager.sendHeartbeat(dn, null);
+        nodeManager.processHeartbeat(dn);
       }
 
       // Wait for 2 seconds, wait a total of 4 seconds to make sure that the
@@ -455,7 +443,7 @@ public class TestNodeManager {
 
       // heartbeat good nodes again.
       for (DatanodeDetails dn : nodeList) {
-        nodeManager.sendHeartbeat(dn, null);
+        nodeManager.processHeartbeat(dn);
       }
 
       //  6 seconds is the dead window for this test , so we wait a total of
@@ -491,7 +479,7 @@ public class TestNodeManager {
   public void testScmCheckForErrorOnNullDatanodeDetails() throws IOException,
       InterruptedException, TimeoutException {
     try (SCMNodeManager nodeManager = createNodeManager(getConf())) {
-      nodeManager.sendHeartbeat(null, null);
+      nodeManager.processHeartbeat(null);
     } catch (NullPointerException npe) {
       GenericTestUtils.assertExceptionContains("Heartbeat is missing " +
           "DatanodeDetails.", npe);
@@ -568,12 +556,9 @@ public class TestNodeManager {
           TestUtils.getDatanodeDetails(nodeManager);
       DatanodeDetails deadNode =
           TestUtils.getDatanodeDetails(nodeManager);
-      nodeManager.sendHeartbeat(
-          healthyNode, null);
-      nodeManager.sendHeartbeat(
-          staleNode, null);
-      nodeManager.sendHeartbeat(
-          deadNode, null);
+      nodeManager.processHeartbeat(healthyNode);
+      nodeManager.processHeartbeat(staleNode);
+      nodeManager.processHeartbeat(deadNode);
 
       // Sleep so that heartbeat processing thread gets to run.
       Thread.sleep(500);
@@ -599,16 +584,12 @@ public class TestNodeManager {
        * the 3 second windows.
        */
 
-      nodeManager.sendHeartbeat(
-          healthyNode, null);
-      nodeManager.sendHeartbeat(
-          staleNode, null);
-      nodeManager.sendHeartbeat(
-          deadNode, null);
+      nodeManager.processHeartbeat(healthyNode);
+      nodeManager.processHeartbeat(staleNode);
+      nodeManager.processHeartbeat(deadNode);
 
       Thread.sleep(1500);
-      nodeManager.sendHeartbeat(
-          healthyNode, null);
+      nodeManager.processHeartbeat(healthyNode);
       Thread.sleep(2 * 1000);
       assertEquals(1, nodeManager.getNodeCount(HEALTHY));
 
@@ -628,13 +609,10 @@ public class TestNodeManager {
        * staleNode to move to stale state and deadNode to move to dead state.
        */
 
-      nodeManager.sendHeartbeat(
-          healthyNode, null);
-      nodeManager.sendHeartbeat(
-          staleNode, null);
+      nodeManager.processHeartbeat(healthyNode);
+      nodeManager.processHeartbeat(staleNode);
       Thread.sleep(1500);
-      nodeManager.sendHeartbeat(
-          healthyNode, null);
+      nodeManager.processHeartbeat(healthyNode);
       Thread.sleep(2 * 1000);
 
       // 3.5 seconds have elapsed for stale node, so it moves into Stale.
@@ -667,12 +645,9 @@ public class TestNodeManager {
        * Cluster State : let us heartbeat all the nodes and verify that we get
        * back all the nodes in healthy state.
        */
-      nodeManager.sendHeartbeat(
-          healthyNode, null);
-      nodeManager.sendHeartbeat(
-          staleNode, null);
-      nodeManager.sendHeartbeat(
-          deadNode, null);
+      nodeManager.processHeartbeat(healthyNode);
+      nodeManager.processHeartbeat(staleNode);
+      nodeManager.processHeartbeat(deadNode);
       Thread.sleep(500);
       //Assert all nodes are healthy.
       assertEquals(3, nodeManager.getAllNodes().size());
@@ -693,7 +668,7 @@ public class TestNodeManager {
                                 int sleepDuration) throws InterruptedException {
     while (!Thread.currentThread().isInterrupted()) {
       for (DatanodeDetails dn : list) {
-        manager.sendHeartbeat(dn, null);
+        manager.processHeartbeat(dn);
       }
       Thread.sleep(sleepDuration);
     }
@@ -747,7 +722,6 @@ public class TestNodeManager {
     conf.setTimeDuration(OZONE_SCM_HEARTBEAT_INTERVAL, 1, SECONDS);
     conf.setTimeDuration(OZONE_SCM_STALENODE_INTERVAL, 3, SECONDS);
     conf.setTimeDuration(OZONE_SCM_DEADNODE_INTERVAL, 6, SECONDS);
-    conf.setInt(OZONE_SCM_MAX_HB_COUNT_TO_PROCESS, 7000);
 
 
     try (SCMNodeManager nodeManager = createNodeManager(conf)) {
@@ -779,7 +753,7 @@ public class TestNodeManager {
       // No Thread just one time HBs the node manager, so that these will be
       // marked as dead nodes eventually.
       for (DatanodeDetails dn : deadNodeList) {
-        nodeManager.sendHeartbeat(dn, null);
+        nodeManager.processHeartbeat(dn);
       }
 
 
@@ -883,54 +857,6 @@ public class TestNodeManager {
     }
   }
 
-  /**
-   * Asserts that SCM backs off from HB processing instead of going into an
-   * infinite loop if SCM is flooded with too many heartbeats. This many not be
-   * the best thing to do, but SCM tries to protect itself and logs an error
-   * saying that it is getting flooded with heartbeats. In real world this can
-   * lead to many nodes becoming stale or dead due to the fact that SCM is not
-   * able to keep up with heartbeat processing. This test just verifies that SCM
-   * will log that information.
-   * @throws TimeoutException
-   */
-  @Test
-  public void testScmLogsHeartbeatFlooding() throws IOException,
-      InterruptedException, TimeoutException {
-    final int healthyCount = 3000;
-
-    // Make the HB process thread run slower.
-    OzoneConfiguration conf = getConf();
-    conf.setTimeDuration(OZONE_SCM_HEARTBEAT_PROCESS_INTERVAL, 500,
-        TimeUnit.MILLISECONDS);
-    conf.setTimeDuration(OZONE_SCM_HEARTBEAT_INTERVAL, 1, SECONDS);
-    conf.setInt(OZONE_SCM_MAX_HB_COUNT_TO_PROCESS, 500);
-
-    try (SCMNodeManager nodeManager = createNodeManager(conf)) {
-      List<DatanodeDetails> healthyList = createNodeSet(nodeManager,
-          healthyCount);
-      GenericTestUtils.LogCapturer logCapturer =
-          GenericTestUtils.LogCapturer.captureLogs(SCMNodeManager.LOG);
-      Runnable healthyNodeTask = () -> {
-        try {
-          // No wait in the HB sending loop.
-          heartbeatNodeSet(nodeManager, healthyList, 0);
-        } catch (InterruptedException ignored) {
-        }
-      };
-      Thread thread1 = new Thread(healthyNodeTask);
-      thread1.setDaemon(true);
-      thread1.start();
-
-      GenericTestUtils.waitFor(() -> logCapturer.getOutput()
-          .contains("SCM is being "
-              + "flooded by heartbeats. Not able to keep up"
-              + " with the heartbeat counts."),
-          500, 20 * 1000);
-
-      thread1.interrupt();
-      logCapturer.stopCapturing();
-    }
-  }
 
   @Test
   public void testScmEnterAndExitChillMode() throws IOException,
@@ -943,8 +869,7 @@ public class TestNodeManager {
       nodeManager.setMinimumChillModeNodes(10);
       DatanodeDetails datanodeDetails = TestUtils.getDatanodeDetails(
           nodeManager);
-      nodeManager.sendHeartbeat(
-          datanodeDetails, null);
+      nodeManager.processHeartbeat(datanodeDetails);
       String status = nodeManager.getChillModeStatus();
       Assert.assertThat(status, containsString("Still in chill " +
           "mode, waiting on nodes to report in."));
@@ -971,7 +896,7 @@ public class TestNodeManager {
       // Assert that node manager force enter cannot be overridden by nodes HBs.
       for (int x = 0; x < 20; x++) {
         DatanodeDetails datanode = TestUtils.getDatanodeDetails(nodeManager);
-        nodeManager.sendHeartbeat(datanode, null);
+        nodeManager.processHeartbeat(datanode);
       }
 
       Thread.sleep(500);
@@ -995,6 +920,8 @@ public class TestNodeManager {
    * @throws TimeoutException
    */
   @Test
+  @Ignore
+  // TODO: Enable this after we implement NodeReportEvent handler.
   public void testScmStatsFromNodeReport() throws IOException,
       InterruptedException, TimeoutException {
     OzoneConfiguration conf = getConf();
@@ -1015,11 +942,10 @@ public class TestNodeManager {
         List<StorageReportProto> reports = TestUtils
             .createStorageReport(capacity, used, free, storagePath,
                 null, dnId, 1);
-        nodeManager.sendHeartbeat(datanodeDetails,
-            TestUtils.createNodeReport(reports));
+        nodeManager.processHeartbeat(datanodeDetails);
       }
-      GenericTestUtils.waitFor(() -> nodeManager.waitForHeartbeatProcessed(),
-          100, 4 * 1000);
+      //TODO: wait for heartbeat to be processed
+      Thread.sleep(4 * 1000);
       assertEquals(nodeCount, nodeManager.getNodeCount(HEALTHY));
       assertEquals(capacity * nodeCount, (long) nodeManager.getStats()
           .getCapacity().get());
@@ -1038,6 +964,8 @@ public class TestNodeManager {
    * @throws TimeoutException
    */
   @Test
+  @Ignore
+  // TODO: Enable this after we implement NodeReportEvent handler.
   public void testScmNodeReportUpdate() throws IOException,
       InterruptedException, TimeoutException {
     OzoneConfiguration conf = getConf();
@@ -1065,8 +993,7 @@ public class TestNodeManager {
             .createStorageReport(capacity, scmUsed, remaining, storagePath,
                 null, dnId, 1);
 
-        nodeManager.sendHeartbeat(datanodeDetails,
-            TestUtils.createNodeReport(reports));
+        nodeManager.processHeartbeat(datanodeDetails);
         Thread.sleep(100);
       }
 
@@ -1146,8 +1073,7 @@ public class TestNodeManager {
       List<StorageReportProto> reports = TestUtils
           .createStorageReport(capacity, expectedScmUsed, expectedRemaining,
               storagePath, null, dnId, 1);
-      nodeManager.sendHeartbeat(datanodeDetails,
-          TestUtils.createNodeReport(reports));
+      nodeManager.processHeartbeat(datanodeDetails);
 
       // Wait up to 5 seconds so that the dead node becomes healthy
       // Verify usage info should be updated.
@@ -1195,7 +1121,7 @@ public class TestNodeManager {
 
       eq.processAll(1000L);
       List<SCMCommand> command =
-          nodemanager.sendHeartbeat(datanodeDetails, null);
+          nodemanager.processHeartbeat(datanodeDetails);
       Assert.assertEquals(1, command.size());
       Assert
           .assertEquals(command.get(0).getClass(), CloseContainerCommand.class);

http://git-wip-us.apache.org/repos/asf/hadoop/blob/71df8c27/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/ozone/container/testutils/ReplicationNodeManagerMock.java
----------------------------------------------------------------------
diff --git a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/ozone/container/testutils/ReplicationNodeManagerMock.java b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/ozone/container/testutils/ReplicationNodeManagerMock.java
index 1a4dcd7..e15e0fc 100644
--- a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/ozone/container/testutils/ReplicationNodeManagerMock.java
+++ b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/ozone/container/testutils/ReplicationNodeManagerMock.java
@@ -21,7 +21,7 @@ import org.apache.hadoop.hdds.scm.container.placement.metrics.SCMNodeMetric;
 import org.apache.hadoop.hdds.scm.container.placement.metrics.SCMNodeStat;
 import org.apache.hadoop.hdds.scm.node.CommandQueue;
 import org.apache.hadoop.hdds.scm.node.NodeManager;
-import org.apache.hadoop.hdfs.protocol.UnregisteredNodeException;
+import org.apache.hadoop.hdds.scm.node.states.NodeNotFoundException;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeState;
 import org.apache.hadoop.hdds.protocol.proto
@@ -31,7 +31,6 @@ import org.apache.hadoop.hdds.protocol.proto
 import org.apache.hadoop.ozone.protocol.VersionResponse;
 import org.apache.hadoop.ozone.protocol.commands.RegisteredCommand;
 import org.apache.hadoop.ozone.protocol.commands.SCMCommand;
-import org.mockito.Mockito;
 
 import java.io.IOException;
 import java.util.List;
@@ -90,11 +89,11 @@ public class ReplicationNodeManagerMock implements NodeManager {
    * Removes a data node from the management of this Node Manager.
    *
    * @param node - DataNode.
-   * @throws UnregisteredNodeException
+   * @throws NodeNotFoundException
    */
   @Override
   public void removeNode(DatanodeDetails node)
-      throws UnregisteredNodeException {
+      throws NodeNotFoundException {
     nodeStateMap.remove(node);
 
   }
@@ -202,16 +201,6 @@ public class ReplicationNodeManagerMock implements NodeManager {
 
 
   /**
-   * Wait for the heartbeat is processed by NodeManager.
-   *
-   * @return true if heartbeat has been processed.
-   */
-  @Override
-  public boolean waitForHeartbeatProcessed() {
-    return false;
-  }
-
-  /**
    * Returns the node state of a specific node.
    *
    * @param dd - DatanodeDetails
@@ -241,22 +230,6 @@ public class ReplicationNodeManagerMock implements NodeManager {
   }
 
   /**
-   * When an object implementing interface <code>Runnable</code> is used
-   * to create a thread, starting the thread causes the object's
-   * <code>run</code> method to be called in that separately executing
-   * thread.
-   * <p>
-   * The general contract of the method <code>run</code> is that it may
-   * take any action whatsoever.
-   *
-   * @see Thread#run()
-   */
-  @Override
-  public void run() {
-
-  }
-
-  /**
    * Gets the version info from SCM.
    *
    * @param versionRequest - version Request.
@@ -285,12 +258,10 @@ public class ReplicationNodeManagerMock implements NodeManager {
    * Send heartbeat to indicate the datanode is alive and doing well.
    *
    * @param dd - Datanode Details.
-   * @param nodeReport - node report.
    * @return SCMheartbeat response list
    */
   @Override
-  public List<SCMCommand> sendHeartbeat(DatanodeDetails dd,
-      NodeReportProto nodeReport) {
+  public List<SCMCommand> processHeartbeat(DatanodeDetails dd) {
     return null;
   }
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/71df8c27/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestStorageContainerManager.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestStorageContainerManager.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestStorageContainerManager.java
index d07097c..dd1a8de 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestStorageContainerManager.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestStorageContainerManager.java
@@ -303,8 +303,8 @@ public class TestStorageContainerManager {
     GenericTestUtils.waitFor(() -> {
       NodeManager nodeManager = cluster.getStorageContainerManager()
           .getScmNodeManager();
-      List<SCMCommand> commands = nodeManager.sendHeartbeat(
-          nodeManager.getNodes(NodeState.HEALTHY).get(0), null);
+      List<SCMCommand> commands = nodeManager.processHeartbeat(
+          nodeManager.getNodes(NodeState.HEALTHY).get(0));
 
       if (commands != null) {
         for (SCMCommand cmd : commands) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/71df8c27/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/node/TestQueryNode.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/node/TestQueryNode.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/node/TestQueryNode.java
index b999c92..22528e4 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/node/TestQueryNode.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/node/TestQueryNode.java
@@ -26,7 +26,7 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.EnumSet;
+import java.util.List;
 import java.util.concurrent.TimeUnit;
 
 import static java.util.concurrent.TimeUnit.SECONDS;
@@ -83,11 +83,10 @@ public class TestQueryNode {
 
   @Test
   public void testHealthyNodesCount() throws Exception {
-    HddsProtos.NodePool pool = scmClient.queryNode(
-        EnumSet.of(HEALTHY),
+    List<HddsProtos.Node> nodes = scmClient.queryNode(HEALTHY,
         HddsProtos.QueryScope.CLUSTER, "");
     assertEquals("Expected  live nodes", numOfDatanodes,
-        pool.getNodesCount());
+        nodes.size());
   }
 
   @Test(timeout = 10 * 1000L)
@@ -99,8 +98,8 @@ public class TestQueryNode {
             cluster.getStorageContainerManager().getNodeCount(STALE) == 2,
         100, 4 * 1000);
 
-    int nodeCount = scmClient.queryNode(EnumSet.of(STALE),
-        HddsProtos.QueryScope.CLUSTER, "").getNodesCount();
+    int nodeCount = scmClient.queryNode(STALE,
+        HddsProtos.QueryScope.CLUSTER, "").size();
     assertEquals("Mismatch of expected nodes count", 2, nodeCount);
 
     GenericTestUtils.waitFor(() ->
@@ -108,13 +107,13 @@ public class TestQueryNode {
         100, 4 * 1000);
 
     // Assert that we don't find any stale nodes.
-    nodeCount = scmClient.queryNode(EnumSet.of(STALE),
-        HddsProtos.QueryScope.CLUSTER, "").getNodesCount();
+    nodeCount = scmClient.queryNode(STALE,
+        HddsProtos.QueryScope.CLUSTER, "").size();
     assertEquals("Mismatch of expected nodes count", 0, nodeCount);
 
     // Assert that we find the expected number of dead nodes.
-    nodeCount = scmClient.queryNode(EnumSet.of(DEAD),
-        HddsProtos.QueryScope.CLUSTER, "").getNodesCount();
+    nodeCount = scmClient.queryNode(DEAD,
+        HddsProtos.QueryScope.CLUSTER, "").size();
     assertEquals("Mismatch of expected nodes count", 2, nodeCount);
   }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/71df8c27/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java
index dc8fc91..5fa313b 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java
@@ -78,7 +78,6 @@ import java.io.IOException;
 import java.io.PrintStream;
 import java.net.InetSocketAddress;
 import java.util.ArrayList;
-import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -884,9 +883,8 @@ public final class KeySpaceManager extends ServiceRuntimeInfoImpl
             .setValue(scmAddr.getPort()).build());
     services.add(scmServiceInfoBuilder.build());
 
-    List<HddsProtos.Node> nodes = scmContainerClient.queryNode(
-        EnumSet.of(HEALTHY), HddsProtos.QueryScope.CLUSTER, "")
-        .getNodesList();
+    List<HddsProtos.Node> nodes = scmContainerClient.queryNode(HEALTHY,
+        HddsProtos.QueryScope.CLUSTER, "");
 
     for (HddsProtos.Node node : nodes) {
       HddsProtos.DatanodeDetailsProto datanode = node.getNodeID();


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org