You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by om...@apache.org on 2011/03/04 05:05:57 UTC

svn commit: r1077348 - /hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java

Author: omalley
Date: Fri Mar  4 04:05:57 2011
New Revision: 1077348

URL: http://svn.apache.org/viewvc?rev=1077348&view=rev
Log:
commit f38a79a53335c349b455c1a5483dc5cb4f541a30
Author: Devaraj Das <dd...@yahoo-inc.com>
Date:   Fri Mar 19 15:04:20 2010 -0700

    HADOOP:6632 from https://issues.apache.org/jira/secure/attachment/12439307/6632.mr.patch
    
    +++ b/YAHOO-CHANGES.txt
    +    HADOOP-6632. Fix on JobTracker to reuse filesystem handles if possible.
    +    (ddas)
    +

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java

Modified: hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java?rev=1077348&r1=1077347&r2=1077348&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java Fri Mar  4 04:05:57 2011
@@ -19,6 +19,7 @@
 package org.apache.hadoop.mapreduce.security.token;
 
 import java.io.IOException;
+import java.net.InetAddress;
 import java.net.URI;
 import org.apache.hadoop.security.AccessControlException;
 import org.apache.hadoop.security.UserGroupInformation;
@@ -203,7 +204,17 @@ public class DelegationTokenRenewal {
   throws Exception {
     DistributedFileSystem dfs = null;
     try {
-      final URI uri = new URI (SCHEME + "://" + token.getService().toString());
+      //TODO: The service is usually an IPaddress:port. We convert
+      //it to dns name and then obtain the filesystem just so that
+      //we reuse the existing filesystem handle (that the jobtracker
+      //might have for this namenode; the namenode is usually
+      //specified as the dns name in the jobtracker).
+      //THIS IS A WORKAROUND FOR NOW. NEED TO SOLVE THIS PROBLEM 
+      //IN A BETTER WAY.
+      String[] ipaddr = token.getService().toString().split(":");
+      InetAddress iaddr = InetAddress.getByName(ipaddr[0]);
+      String dnsName = iaddr.getCanonicalHostName();
+      final URI uri = new URI (SCHEME + "://" + dnsName+":"+ipaddr[1]);
       dfs = (DistributedFileSystem)
       UserGroupInformation.getLoginUser().doAs(
           new PrivilegedExceptionAction<DistributedFileSystem>() {