hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomwh...@apache.org
Subject svn commit: r1311521 - in /hadoop/common/branches/branch-2/hadoop-mapreduce-project: ./ hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/
Date Mon, 09 Apr 2012 23:35:22 GMT
Author: tomwhite
Date: Mon Apr  9 23:35:21 2012
New Revision: 1311521

URL: http://svn.apache.org/viewvc?rev=1311521&view=rev
Log:
Merge -r 1311519:1311520 from trunk to branch-2. Fixes MAPREDUCE-4105.

Added:
    hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestRackResolverScriptBasedMapping.java
      - copied unchanged from r1311520, hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestRackResolverScriptBasedMapping.java
Modified:
    hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt
    hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/RackResolver.java
    hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestRackResolver.java

Modified: hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt?rev=1311521&r1=1311520&r2=1311521&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt Mon Apr  9 23:35:21
2012
@@ -119,6 +119,9 @@ Release 2.0.0 - UNRELEASED
     org.apache.hadoop.mapred.TestMiniMRWithDFSWithDistinctUsers (Devaraj K via
     bobby)
 
+    MAPREDUCE-4105. Yarn RackResolver ignores rack configurations. 
+    (Ahmed Radwan via tomwhite)
+
 Release 0.23.3 - UNRELEASED
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/RackResolver.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/RackResolver.java?rev=1311521&r1=1311520&r2=1311521&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/RackResolver.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/RackResolver.java
Mon Apr  9 23:35:21 2012
@@ -31,6 +31,9 @@ import org.apache.hadoop.net.DNSToSwitch
 import org.apache.hadoop.net.Node;
 import org.apache.hadoop.net.NodeBase;
 import org.apache.hadoop.net.ScriptBasedMapping;
+import org.apache.hadoop.util.ReflectionUtils;
+
+import com.google.common.annotations.VisibleForTesting;
 
 public class RackResolver {
   private static DNSToSwitchMapping dnsToSwitchMapping;
@@ -49,10 +52,8 @@ public class RackResolver {
         ScriptBasedMapping.class,
         DNSToSwitchMapping.class);
     try {
-      Constructor<? extends DNSToSwitchMapping> dnsToSwitchMappingConstructor
-                             = dnsToSwitchMappingClass.getConstructor();
-      DNSToSwitchMapping newInstance =
-          dnsToSwitchMappingConstructor.newInstance();
+      DNSToSwitchMapping newInstance = ReflectionUtils.newInstance(
+          dnsToSwitchMappingClass, conf);
       // Wrap around the configured class with the Cached implementation so as
       // to save on repetitive lookups.
       // Check if the impl is already caching, to avoid double caching.
@@ -99,4 +100,12 @@ public class RackResolver {
     LOG.info("Resolved " + hostName + " to " + rName);
     return new NodeBase(hostName, rName);
   }
+
+  /**
+   * Only used by tests
+   */
+  @VisibleForTesting
+  static DNSToSwitchMapping getDnsToSwitchMapping(){
+    return dnsToSwitchMapping;
+  }
 }

Modified: hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestRackResolver.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestRackResolver.java?rev=1311521&r1=1311520&r2=1311521&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestRackResolver.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestRackResolver.java
Mon Apr  9 23:35:21 2012
@@ -52,7 +52,7 @@ public class TestRackResolver {
       Assert.assertTrue(numHost1 <= 1);
       return returnList;
     }
-    
+
   }
 
   @Test



Mime
View raw message