Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-12173

NetworkTopology#add calls NetworkTopology#toString always

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.7.0
    • Fix Version/s: 2.8.0, 3.0.0-alpha1
    • Component/s: None
    • Labels:
      None
    • Target Version/s:
    • Hadoop Flags:
      Reviewed

      Description

      It always does a toString of the whole topology but this is not required when there are no errors. This is adding a very big overhead to large clusters as it's walking the whole tree every time we add a node to the cluster.

      HADOOP-10953 did some fix in that area but the errors is still there.

        Issue Links

          Activity

          Hide
          elgoiri Inigo Goiri added a comment -

          Currently, the code does:

            public void add(Node node) {
              if (node==null) return;
              int newDepth = NodeBase.locationToDepth(node.getNetworkLocation()) + 1;
              netlock.writeLock().lock();
              try {
                String oldTopoStr = this.toString();
                if( node instanceof InnerNode ) {
                  throw new IllegalArgumentException(
                    "Not allow to add an inner node: "+NodeBase.getPath(node));
                }
                if ((depthOfAllLeaves != -1) && (depthOfAllLeaves != newDepth)) {
                  LOG.error("Error: can't add leaf node " + NodeBase.getPath(node) +
                      " at depth " + newDepth + " to topology:\n" + oldTopoStr);
                  throw new InvalidTopologyException("Failed to add " + NodeBase.getPath(node) +
                      ": You cannot have a rack and a non-rack node at the same " +
                      "level of the network topology.");
                }
          

          This implies doing a toString for every single addition.

          Show
          elgoiri Inigo Goiri added a comment - Currently, the code does: public void add(Node node) { if (node== null ) return ; int newDepth = NodeBase.locationToDepth(node.getNetworkLocation()) + 1; netlock.writeLock().lock(); try { String oldTopoStr = this .toString(); if ( node instanceof InnerNode ) { throw new IllegalArgumentException( "Not allow to add an inner node: " +NodeBase.getPath(node)); } if ((depthOfAllLeaves != -1) && (depthOfAllLeaves != newDepth)) { LOG.error( "Error: can't add leaf node " + NodeBase.getPath(node) + " at depth " + newDepth + " to topology:\n" + oldTopoStr); throw new InvalidTopologyException( "Failed to add " + NodeBase.getPath(node) + ": You cannot have a rack and a non-rack node at the same " + "level of the network topology." ); } This implies doing a toString for every single addition.
          Hide
          elgoiri Inigo Goiri added a comment -

          Patch to fix overcalling toString

          Show
          elgoiri Inigo Goiri added a comment - Patch to fix overcalling toString
          Hide
          hadoopqa Hadoop QA added a comment -



          -1 overall



          Vote Subsystem Runtime Comment
          0 pre-patch 16m 41s Pre-patch trunk compilation is healthy.
          +1 @author 0m 0s The patch does not contain any @author tags.
          -1 tests included 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
          +1 javac 7m 40s There were no new javac warning messages.
          +1 javadoc 9m 35s There were no new javadoc warning messages.
          +1 release audit 0m 23s The applied patch does not increase the total number of release audit warnings.
          +1 checkstyle 1m 5s There were no new checkstyle issues.
          +1 whitespace 0m 0s The patch has no lines that end in whitespace.
          +1 install 1m 33s mvn install still works.
          +1 eclipse:eclipse 0m 33s The patch built with eclipse:eclipse.
          +1 findbugs 1m 52s The patch does not introduce any new Findbugs (version 3.0.0) warnings.
          +1 common tests 22m 42s Tests passed in hadoop-common.
              62m 7s  



          Subsystem Report/Notes
          Patch URL http://issues.apache.org/jira/secure/attachment/12743181/HADOOP-12173-v1.patch
          Optional Tests javadoc javac unit findbugs checkstyle
          git revision trunk / a78d507
          hadoop-common test log https://builds.apache.org/job/PreCommit-HADOOP-Build/7132/artifact/patchprocess/testrun_hadoop-common.txt
          Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/7132/testReport/
          Java 1.7.0_55
          uname Linux asf903.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
          Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/7132/console

          This message was automatically generated.

          Show
          hadoopqa Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 pre-patch 16m 41s Pre-patch trunk compilation is healthy. +1 @author 0m 0s The patch does not contain any @author tags. -1 tests included 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 javac 7m 40s There were no new javac warning messages. +1 javadoc 9m 35s There were no new javadoc warning messages. +1 release audit 0m 23s The applied patch does not increase the total number of release audit warnings. +1 checkstyle 1m 5s There were no new checkstyle issues. +1 whitespace 0m 0s The patch has no lines that end in whitespace. +1 install 1m 33s mvn install still works. +1 eclipse:eclipse 0m 33s The patch built with eclipse:eclipse. +1 findbugs 1m 52s The patch does not introduce any new Findbugs (version 3.0.0) warnings. +1 common tests 22m 42s Tests passed in hadoop-common.     62m 7s   Subsystem Report/Notes Patch URL http://issues.apache.org/jira/secure/attachment/12743181/HADOOP-12173-v1.patch Optional Tests javadoc javac unit findbugs checkstyle git revision trunk / a78d507 hadoop-common test log https://builds.apache.org/job/PreCommit-HADOOP-Build/7132/artifact/patchprocess/testrun_hadoop-common.txt Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/7132/testReport/ Java 1.7.0_55 uname Linux asf903.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/7132/console This message was automatically generated.
          Hide
          chris.douglas Chris Douglas added a comment -

          +1 No test required. If there is a 2.7.2, then this should probably get backported.

          Show
          chris.douglas Chris Douglas added a comment - +1 No test required. If there is a 2.7.2, then this should probably get backported.
          Hide
          chris.douglas Chris Douglas added a comment -

          I committed this. Thanks, Inigo

          Show
          chris.douglas Chris Douglas added a comment - I committed this. Thanks, Inigo
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-trunk-Commit #8112 (See https://builds.apache.org/job/Hadoop-trunk-Commit/8112/)
          HADOOP-12173. NetworkTopology::add calls toString always. Contributed by Inigo Goiri (cdouglas: rev e59f6fad6a8849cfab6acbf012f338d9cc7dd63c)

          • hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetworkTopology.java
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-trunk-Commit #8112 (See https://builds.apache.org/job/Hadoop-trunk-Commit/8112/ ) HADOOP-12173 . NetworkTopology::add calls toString always. Contributed by Inigo Goiri (cdouglas: rev e59f6fad6a8849cfab6acbf012f338d9cc7dd63c) hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetworkTopology.java
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Yarn-trunk-Java8 #246 (See https://builds.apache.org/job/Hadoop-Yarn-trunk-Java8/246/)
          HADOOP-12173. NetworkTopology::add calls toString always. Contributed by Inigo Goiri (cdouglas: rev e59f6fad6a8849cfab6acbf012f338d9cc7dd63c)

          • hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetworkTopology.java
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Yarn-trunk-Java8 #246 (See https://builds.apache.org/job/Hadoop-Yarn-trunk-Java8/246/ ) HADOOP-12173 . NetworkTopology::add calls toString always. Contributed by Inigo Goiri (cdouglas: rev e59f6fad6a8849cfab6acbf012f338d9cc7dd63c) hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetworkTopology.java
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Hadoop-Yarn-trunk #976 (See https://builds.apache.org/job/Hadoop-Yarn-trunk/976/)
          HADOOP-12173. NetworkTopology::add calls toString always. Contributed by Inigo Goiri (cdouglas: rev e59f6fad6a8849cfab6acbf012f338d9cc7dd63c)

          • hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetworkTopology.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Hadoop-Yarn-trunk #976 (See https://builds.apache.org/job/Hadoop-Yarn-trunk/976/ ) HADOOP-12173 . NetworkTopology::add calls toString always. Contributed by Inigo Goiri (cdouglas: rev e59f6fad6a8849cfab6acbf012f338d9cc7dd63c) hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetworkTopology.java
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Mapreduce-trunk-Java8 #244 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Java8/244/)
          HADOOP-12173. NetworkTopology::add calls toString always. Contributed by Inigo Goiri (cdouglas: rev e59f6fad6a8849cfab6acbf012f338d9cc7dd63c)

          • hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetworkTopology.java
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Mapreduce-trunk-Java8 #244 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Java8/244/ ) HADOOP-12173 . NetworkTopology::add calls toString always. Contributed by Inigo Goiri (cdouglas: rev e59f6fad6a8849cfab6acbf012f338d9cc7dd63c) hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetworkTopology.java
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Hdfs-trunk-Java8 #234 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Java8/234/)
          HADOOP-12173. NetworkTopology::add calls toString always. Contributed by Inigo Goiri (cdouglas: rev e59f6fad6a8849cfab6acbf012f338d9cc7dd63c)

          • hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetworkTopology.java
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Hdfs-trunk-Java8 #234 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Java8/234/ ) HADOOP-12173 . NetworkTopology::add calls toString always. Contributed by Inigo Goiri (cdouglas: rev e59f6fad6a8849cfab6acbf012f338d9cc7dd63c) hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetworkTopology.java
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Hadoop-Hdfs-trunk #2173 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/2173/)
          HADOOP-12173. NetworkTopology::add calls toString always. Contributed by Inigo Goiri (cdouglas: rev e59f6fad6a8849cfab6acbf012f338d9cc7dd63c)

          • hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetworkTopology.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Hadoop-Hdfs-trunk #2173 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/2173/ ) HADOOP-12173 . NetworkTopology::add calls toString always. Contributed by Inigo Goiri (cdouglas: rev e59f6fad6a8849cfab6acbf012f338d9cc7dd63c) hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetworkTopology.java
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Mapreduce-trunk #2192 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/2192/)
          HADOOP-12173. NetworkTopology::add calls toString always. Contributed by Inigo Goiri (cdouglas: rev e59f6fad6a8849cfab6acbf012f338d9cc7dd63c)

          • hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetworkTopology.java
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Mapreduce-trunk #2192 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/2192/ ) HADOOP-12173 . NetworkTopology::add calls toString always. Contributed by Inigo Goiri (cdouglas: rev e59f6fad6a8849cfab6acbf012f338d9cc7dd63c) hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetworkTopology.java

            People

            • Assignee:
              elgoiri Inigo Goiri
              Reporter:
              elgoiri Inigo Goiri
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development