You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-commits@hadoop.apache.org by am...@apache.org on 2011/11/08 05:48:57 UTC

svn commit: r1199106 - in /hadoop/common/branches/branch-0.23/hadoop-mapreduce-project: CHANGES.txt src/tools/org/apache/hadoop/tools/rumen/LoggedTaskAttempt.java

Author: amarrk
Date: Tue Nov  8 04:48:57 2011
New Revision: 1199106

URL: http://svn.apache.org/viewvc?rev=1199106&view=rev
Log:
MAPREDUCE-3346. [Rumen] LoggedTaskAttempt#getHostName() returns null. (amarrk)

Modified:
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/tools/org/apache/hadoop/tools/rumen/LoggedTaskAttempt.java

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt?rev=1199106&r1=1199105&r2=1199106&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt Tue Nov  8 04:48:57 2011
@@ -15,6 +15,8 @@ Release 0.23.1 - Unreleased
   OPTIMIZATIONS
 
   BUG FIXES
+    MAPREDUCE-3346 [Rumen] LoggedTaskAttempt#getHostName() returns null.
+                   (amarrk)
 
     MAPREDUCE-3221. Reenabled the previously ignored test in TestSubmitJob
     and fixed bugs in it. (Devaraj K via vinodkv)

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/tools/org/apache/hadoop/tools/rumen/LoggedTaskAttempt.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/tools/org/apache/hadoop/tools/rumen/LoggedTaskAttempt.java?rev=1199106&r1=1199105&r2=1199106&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/tools/org/apache/hadoop/tools/rumen/LoggedTaskAttempt.java (original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/src/tools/org/apache/hadoop/tools/rumen/LoggedTaskAttempt.java Tue Nov  8 04:48:57 2011
@@ -328,11 +328,27 @@ public class LoggedTaskAttempt implement
     return hostName;
   }
 
-
+  void setHostName(String hostName) {
+    this.hostName = hostName;
+  }
+  
   // hostName is saved in the format rackName/NodeName
   void setHostName(String hostName, String rackName) {
-    this.hostName = hostName == null || rackName == null ? null
-        : rackName.intern() + "/" + hostName.intern();
+    if (hostName == null || hostName.length() == 0) {
+      throw new RuntimeException("Invalid entry! Missing hostname");
+    } else if (rackName == null || rackName.length() == 0) {
+      setHostName(hostName);
+    } else {
+      // make sure that the rackname is prefixed with a '/'
+      if (!rackName.startsWith("/")) {
+        rackName = "/" + rackName;
+      }
+      // make sure that the hostname is prefixed with a '/'
+      if (!hostName.startsWith("/")) {
+        hostName = "/" + hostName;
+      }
+      setHostName(rackName.intern() + hostName.intern());
+    }
   }
 
   public long getHdfsBytesRead() {