hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1077654 - in /hadoop/common/branches/branch-0.20-security-patches/src: mapred/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java test/org/apache/hadoop/mapreduce/security/token/TestDelegationTokenRenewal.java
Date Fri, 04 Mar 2011 04:40:46 GMT
Author: omalley
Date: Fri Mar  4 04:40:45 2011
New Revision: 1077654

URL: http://svn.apache.org/viewvc?rev=1077654&view=rev
Log:
commit 8537203f2e6eb859f90a59794330688a8cc762ae
Author: Boris Shkolnik <borya@yahoo-inc.com>
Date:   Fri Aug 13 11:30:18 2010 -0700

    MAPREDUCE:2005 from https://issues.apache.org/jira/secure/attachment/12451804/MAPREDUCE-2005-YH20.patch
    
    +++ b/YAHOO-CHANGES.txt
    +    MAPREDUCE-2005. TestDelegationTokenRenewal fails (boryas)

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java
    hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapreduce/security/token/TestDelegationTokenRenewal.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=1077654&r1=1077653&r2=1077654&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:40:45 2011
@@ -233,7 +233,7 @@ public class DelegationTokenRenewal {
   }
   
   /**
-   * find the soonest expiring token and set it for renew
+   * set task to renew the token
    */
   private static void setTimerForTokenRenewal(
       DelegationTokenToRenew token, boolean firstTime) {
@@ -245,11 +245,11 @@ public class DelegationTokenRenewal {
       renewIn = now;
     } else {
       long expiresIn = (token.expirationDate - now); 
-      renewIn = now + expiresIn - expiresIn/10; // little before expiration
+      renewIn = now + expiresIn - expiresIn/10; // little bit before the expiration
     }
     
     try {
-      // need to create new timer every time
+      // need to create new task every time
       TimerTask tTask = new RenewalTimerTask(token);
       token.setTimerTask(tTask); // keep reference to the timer
 

Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapreduce/security/token/TestDelegationTokenRenewal.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapreduce/security/token/TestDelegationTokenRenewal.java?rev=1077654&r1=1077653&r2=1077654&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapreduce/security/token/TestDelegationTokenRenewal.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapreduce/security/token/TestDelegationTokenRenewal.java
Fri Mar  4 04:40:45 2011
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
+import java.net.InetAddress;
 import java.net.URI;
 import java.net.URISyntaxException;
 
@@ -62,8 +63,10 @@ public class TestDelegationTokenRenewal 
     
     // create a fake FileSystem (MyFS) and assosiate it
     // with "hdfs" schema.
-    URI uri = new URI(DelegationTokenRenewal.SCHEME+"://localhost:0");
-    System.out.println("scheme is : " + uri.getScheme());
+    InetAddress iaddr = InetAddress.getByName("localhost");
+    String dnsName = iaddr.getCanonicalHostName();
+    final URI uri = new URI (DelegationTokenRenewal.SCHEME + "://" + dnsName+":"+"0");
+    
     conf.setClass("fs." + uri.getScheme() + ".impl", MyFS.class, DistributedFileSystem.class);
     FileSystem.setDefaultUri(conf, uri);
     System.out.println("filesystem uri = " + FileSystem.getDefaultUri(conf).toString());
@@ -145,7 +148,8 @@ public class TestDelegationTokenRenewal 
       }
       counter ++;
       this.token = (MyToken)token;
-      System.out.println("Called MYDFS.renewdelegationtoken " + token);
+      System.out.println("Called MYDFS.renewdelegationtoken " + token + 
+          ";this dfs=" + this.hashCode() + ";c=" + counter);
       if(tokenToRenewIn2Sec == token) { 
         // this token first renewal in 2 seconds
         System.out.println("RENEW in 2 seconds");
@@ -174,7 +178,7 @@ public class TestDelegationTokenRenewal 
   }
   
   /**
-   * auxilary - create token
+   * Auxiliary - create token
    * @param renewer
    * @return
    * @throws IOException
@@ -220,7 +224,7 @@ public class TestDelegationTokenRenewal 
   @Test
   public void testDTRenewal () throws IOException, URISyntaxException {
     MyFS dfs = (MyFS)FileSystem.get(conf);
-    System.out.println("dfs="+(Object)dfs);
+    System.out.println("dfs="+(Object)dfs.hashCode() + ";conf="+conf.hashCode());
     // Test 1. - add three tokens - make sure exactly one get's renewed
     
     // get the delegation tokens
@@ -233,7 +237,7 @@ public class TestDelegationTokenRenewal 
     dfs.setTokenToRenewIn2Sec(token1); 
     System.out.println("token="+token1+" should be renewed for 2 secs");
     
-    // two distinct Namenodes
+    // three distinct Namenodes
     String nn1 = DelegationTokenRenewal.SCHEME + "://host1:0";
     String nn2 = DelegationTokenRenewal.SCHEME + "://host2:0";
     String nn3 = DelegationTokenRenewal.SCHEME + "://host3:0";
@@ -262,8 +266,8 @@ public class TestDelegationTokenRenewal 
         break;
     }
     
-    System.out.println("Counter = " + dfs.getCounter() + ";t="+
-        dfs.getToken());
+    System.out.println("dfs=" + dfs.hashCode() + 
+        ";Counter = " + dfs.getCounter() + ";t="+  dfs.getToken());
     assertEquals("renew wasn't called as many times as expected(4):",
         numberOfExpectedRenewals, dfs.getCounter());
     assertEquals("most recently renewed token mismatch", dfs.getToken(), 



Mime
View raw message