[ 
https://issues.apache.org/jira/browse/HDDS-699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16784986#comment-16784986
 ] 

Tsz Wo Nicholas Sze commented on HDDS-699:
------------------------------------------

Some initial comments on the 04 patch.  (will continue reviewing it.)
- remove setCost from Node since it is never used.
- In NodeImpl, change name, location and cost to final.  We should remove the 
set(..) method, which is only used in constructors, and refactor the code as 
below.
{code}
  // host:port#
  private final String name;
  // string representation of this node's location
  private final String location;
  // the cost to go through this node
  private final int cost;
  // which level of the tree the node resides, start from 1 for root
  private int level;
  // node's parent
  private Node parent;

  /**
   * Construct a node from its name and its location.
   * @param name this node's name (can be null, must not contain
   * {@link NetConstants#PATH_SEPARATOR})
   * @param location this node's location
   */
  public NodeImpl(String name, String location, int cost) {
    if (name != null && name.contains(PATH_SEPARATOR_STR)) {
      throw new IllegalArgumentException(
          "Network location name:" + name + " should not contain " +
              PATH_SEPARATOR_STR);
    }
    this.name = (name == null) ? ROOT : name;
    this.location = NetUtils.normalize(location);
    this.cost = cost;
  }

  /**
   * Construct a node from its name and its location.
   * @param name this node's name (can be null, must not contain
   * {@link NetConstants#PATH_SEPARATOR})
   * @param location this node's location
   * @param parent this node's parent node
   * @param level this node's level in the tree
   * @param cost this node's cost if traffic goes through it
   */
  public NodeImpl(String name, String location, Node parent, int level,
      int cost) {
    this(name, location, cost);
    this.parent = parent;
    this.level = level;
  }

// Note that the other constructors are removed.
{code}
- In InnerNode, removes the following methods and change them to private in 
InnerNodeImpl.  They are only used in InnerNodeImpl internally. 
-* getChildren(),
-* getNodes(int level),
-* getLeaf(int leafIndex, Collection<Node> excludedNodes),
-* getLeaf(int leafIndex, String excludedScope), 
-* getLeaf(int leafIndex, Collection<Node> excludedNodes, int ancestorGen),
-* getLeaf(int leafIndex, String excludedScope, Collection<Node> excludedNodes)
-* isParent(Node n),
-* isLeafParent().
- In InnerNodeImpl,
-* rename getAncestorsI to getAncestorsCounts
-* rename getAncestorsII to getAncestorNodes
- NetworkTopologyImpl.toString should acquire readLock.


> Detect Ozone Network topology
> -----------------------------
>
>                 Key: HDDS-699
>                 URL: https://issues.apache.org/jira/browse/HDDS-699
>             Project: Hadoop Distributed Data Store
>          Issue Type: Sub-task
>            Reporter: Xiaoyu Yao
>            Assignee: Sammi Chen
>            Priority: Major
>         Attachments: HDDS-699.00.patch, HDDS-699.01.patch, HDDS-699.02.patch, 
> HDDS-699.03.patch, HDDS-699.04.patch
>
>
> Traditionally this has been implemented in Hadoop via script or customizable 
> java class. One thing we want to add here is the flexible multi-level support 
> instead of fixed levels like DC/Rack/NG/Node.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to