Browse Source

HADOOP-3537. Disallow adding a datanode to a network topology when its network location is resolved. Contributed by Hairong Kuang.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@670686 13f79535-47bb-0310-9956-ffa450edef68
Hairong Kuang 17 years ago
parent
commit
0c94003a05
2 changed files with 9 additions and 1 deletions
  1. 3 0
      CHANGES.txt
  2. 6 1
      src/core/org/apache/hadoop/net/NetworkTopology.java

+ 3 - 0
CHANGES.txt

@@ -701,6 +701,9 @@ Release 0.17.1 - Unreleased
     HADOOP-3320. Fix NullPointerException in NetworkTopology.getDistance().
     (hairong)
 
+    HADOOP-3537. Disallow adding a datanode to a network topology when its
+    network location is not resolved. (hairong)
+
 Release 0.17.0 - 2008-05-18
 
   INCOMPATIBLE CHANGES

+ 6 - 1
src/core/org/apache/hadoop/net/NetworkTopology.java

@@ -184,7 +184,7 @@ public class NetworkTopology {
       if (!isAncestor(n))
         throw new IllegalArgumentException(n.getName()
                                            +", which is located at "
-                                           +parent+", is not a decendent of "+currentPath);
+                                           +parent+", is not a descendent of "+currentPath);
       if (isParent(n)) {
         // this node is the parent of n; remove n directly
         for(int i=0; i<children.size(); i++) {
@@ -344,6 +344,11 @@ public class NetworkTopology {
    */ 
   public void remove(Node node) {
     if (node==null) return;
+    if (NetworkTopology.UNRESOLVED.equals(node.getNetworkLocation())) {
+      // the node's network location has not resolved yet; 
+      // so it is not in the network topology
+      return;  
+    }
     if( node instanceof InnerNode ) {
       throw new IllegalArgumentException(
         "Not allow to remove an inner node: "+NodeBase.getPath(node));