hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vino...@apache.org
Subject svn commit: r1574191 - in /hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src: main/java/org/apache/hadoop/mapred/ test/java/org/apache/hadoop/mapred/
Date Tue, 04 Mar 2014 20:39:33 GMT
Author: vinodkv
Date: Tue Mar  4 20:39:33 2014
New Revision: 1574191

URL: http://svn.apache.org/r1574191
Log:
YARN-986. Changed client side to be able to figure out the right RM Delegation token for the
right ResourceManager when HA is enabled. Contributed by Karthik Kambatla.
svn merge --ignore-ancestry -c 1574190 ../../trunk/

Modified:
    hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ResourceMgrDelegate.java
    hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YARNRunner.java
    hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestYARNRunner.java

Modified: hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ResourceMgrDelegate.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ResourceMgrDelegate.java?rev=1574191&r1=1574190&r2=1574191&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ResourceMgrDelegate.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ResourceMgrDelegate.java
Tue Mar  4 20:39:33 2014
@@ -19,7 +19,6 @@
 package org.apache.hadoop.mapred;
 
 import java.io.IOException;
-import java.net.InetSocketAddress;
 import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.List;
@@ -56,6 +55,7 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.api.records.NodeState;
 import org.apache.hadoop.yarn.api.records.YarnApplicationState;
 import org.apache.hadoop.yarn.api.records.YarnClusterMetrics;
+import org.apache.hadoop.yarn.client.ClientRMProxy;
 import org.apache.hadoop.yarn.client.api.YarnClient;
 import org.apache.hadoop.yarn.client.api.YarnClientApplication;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
@@ -74,7 +74,7 @@ public class ResourceMgrDelegate extends
   @Private
   @VisibleForTesting
   protected YarnClient client;
-  private InetSocketAddress rmAddress;
+  private Text rmDTService;
 
   /**
    * Delegate responsible for communicating with the Resource Manager's
@@ -91,9 +91,6 @@ public class ResourceMgrDelegate extends
 
   @Override
   protected void serviceInit(Configuration conf) throws Exception {
-    this.rmAddress = conf.getSocketAddr(YarnConfiguration.RM_ADDRESS,
-          YarnConfiguration.DEFAULT_RM_ADDRESS,
-          YarnConfiguration.DEFAULT_RM_PORT);
     client.init(conf);
     super.serviceInit(conf);
   }
@@ -155,8 +152,11 @@ public class ResourceMgrDelegate extends
     }
   }
 
-  InetSocketAddress getConnectAddress() {
-    return rmAddress;
+  public Text getRMDelegationTokenService() {
+    if (rmDTService == null) {
+      rmDTService = ClientRMProxy.getRMDelegationTokenService(conf);
+    }
+    return rmDTService;
   }
   
   @SuppressWarnings("rawtypes")
@@ -164,7 +164,7 @@ public class ResourceMgrDelegate extends
       InterruptedException {
     try {
       return ConverterUtils.convertFromYarn(
-          client.getRMDelegationToken(renewer), rmAddress);
+          client.getRMDelegationToken(renewer), getRMDelegationTokenService());
     } catch (YarnException e) {
       throw new IOException(e);
     }

Modified: hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YARNRunner.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YARNRunner.java?rev=1574191&r1=1574190&r2=1574191&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YARNRunner.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YARNRunner.java
Tue Mar  4 20:39:33 2014
@@ -188,8 +188,7 @@ public class YARNRunner implements Clien
        * to make sure we add history server delegation tokens to the credentials
        */
       RMDelegationTokenSelector tokenSelector = new RMDelegationTokenSelector();
-      Text service = SecurityUtil.buildTokenService(resMgrDelegate
-          .getConnectAddress());
+      Text service = resMgrDelegate.getRMDelegationTokenService();
       if (tokenSelector.selectToken(service, ts.getAllTokens()) != null) {
         Text hsService = SecurityUtil.buildTokenService(hsProxy
             .getConnectAddress());

Modified: hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestYARNRunner.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestYARNRunner.java?rev=1574191&r1=1574190&r2=1574191&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestYARNRunner.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestYARNRunner.java
Tue Mar  4 20:39:33 2014
@@ -299,7 +299,7 @@ public class TestYARNRunner extends Test
           any(GetDelegationTokenRequest.class));
 
       ResourceMgrDelegate rmDelegate = mock(ResourceMgrDelegate.class);
-      doReturn(mockRmAddress).when(rmDelegate).getConnectAddress();
+      doReturn(rmTokenSevice).when(rmDelegate).getRMDelegationTokenService();
 
       ClientCache clientCache = mock(ClientCache.class);
       doReturn(mockHsProxy).when(clientCache).getInitializedHSProxy();



Mime
View raw message