You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by bh...@apache.org on 2020/06/06 04:48:40 UTC

[hadoop-ozone] branch master updated: HDDS-3734. Improve the performance of SCM with 3.86% by avoid TreeSet.addAll (#1027)

This is an automated email from the ASF dual-hosted git repository.

bharat pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new baf8f81  HDDS-3734. Improve the performance of SCM with 3.86% by avoid TreeSet.addAll (#1027)
baf8f81 is described below

commit baf8f8130f9242c7f72e4df9921c34eda8e77b7f
Author: runzhiwang <51...@users.noreply.github.com>
AuthorDate: Sat Jun 6 12:48:29 2020 +0800

    HDDS-3734. Improve the performance of SCM with 3.86% by avoid TreeSet.addAll (#1027)
---
 .../hadoop/hdds/scm/server/SCMClientProtocolServer.java   | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

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 2eea4f6..e049ef5 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
@@ -27,8 +27,6 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
 import java.util.stream.Collectors;
 
 import org.apache.hadoop.fs.CommonConfigurationKeys;
@@ -569,7 +567,7 @@ public class SCMClientProtocolServer implements
    */
   public List<DatanodeDetails> queryNode(HddsProtos.NodeState state) {
     Preconditions.checkNotNull(state, "Node Query set cannot be null");
-    return new ArrayList<>(queryNodeState(state));
+    return queryNodeState(state);
   }
 
   @VisibleForTesting
@@ -589,15 +587,10 @@ public class SCMClientProtocolServer implements
    * Query the System for Nodes.
    *
    * @param nodeState - NodeState that we are interested in matching.
-   * @return Set of Datanodes that match the NodeState.
+   * @return List of Datanodes that match the NodeState.
    */
-  private Set<DatanodeDetails> queryNodeState(HddsProtos.NodeState nodeState) {
-    Set<DatanodeDetails> returnSet = new TreeSet<>();
-    List<DatanodeDetails> tmp = scm.getScmNodeManager().getNodes(nodeState);
-    if ((tmp != null) && (tmp.size() > 0)) {
-      returnSet.addAll(tmp);
-    }
-    return returnSet;
+  private List<DatanodeDetails> queryNodeState(HddsProtos.NodeState nodeState) {
+    return scm.getScmNodeManager().getNodes(nodeState);
   }
 
   @Override


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