hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject svn commit: r1547971 - in /hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs: ./ src/main/java/org/apache/hadoop/hdfs/server/namenode/ src/main/java/org/apache/hadoop/hdfs/web/ src/main/java/org/apache/hadoop/hdfs/web/resources/ src/test/...
Date Thu, 05 Dec 2013 00:06:21 GMT
Author: wang
Date: Thu Dec  5 00:06:20 2013
New Revision: 1547971

URL: http://svn.apache.org/r1547971
Log:
Revert HDFS-4983

Removed:
    hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsConfigKeys.java
Modified:
    hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
    hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeHttpServer.java
    hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
    hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/resources/UserParam.java
    hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHDFS.java
    hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/resources/TestParam.java

Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1547971&r1=1547970&r2=1547971&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Thu Dec  5
00:06:20 2013
@@ -345,9 +345,6 @@ Release 2.3.0 - UNRELEASED
 
     HDFS-4997. libhdfs doesn't return correct error codes in most cases (cmccabe)
 
-    HDFS-4983. Numeric usernames do not work with WebHDFS FS.
-    (Yongjun Zhang via wang)
-
 Release 2.2.0 - 2013-10-13
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeHttpServer.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeHttpServer.java?rev=1547971&r1=1547970&r2=1547971&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeHttpServer.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeHttpServer.java
Thu Dec  5 00:06:20 2013
@@ -36,7 +36,6 @@ import org.apache.hadoop.hdfs.server.nam
 import org.apache.hadoop.hdfs.web.AuthFilter;
 import org.apache.hadoop.hdfs.web.WebHdfsFileSystem;
 import org.apache.hadoop.hdfs.web.resources.Param;
-import org.apache.hadoop.hdfs.web.resources.UserParam;
 import org.apache.hadoop.http.HttpServer;
 import org.apache.hadoop.net.NetUtils;
 import org.apache.hadoop.security.SecurityUtil;
@@ -83,10 +82,7 @@ public class NameNodeHttpServer {
         .setKeytabConfKey(DFSUtil.getSpnegoKeytabKey(conf,
             DFSConfigKeys.DFS_NAMENODE_KEYTAB_FILE_KEY)).build();
     if (WebHdfsFileSystem.isEnabled(conf, HttpServer.LOG)) {
-      // set user pattern based on configuration file
-      UserParam.setUserPattern(conf);
-
-      // add SPNEGO authentication filter for webhdfs
+      //add SPNEGO authentication filter for webhdfs
       final String name = "SPNEGO";
       final String classname = AuthFilter.class.getName();
       final String pathSpec = WebHdfsFileSystem.PATH_PREFIX + "/*";

Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java?rev=1547971&r1=1547970&r2=1547971&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
Thu Dec  5 00:06:20 2013
@@ -167,8 +167,6 @@ public class WebHdfsFileSystem extends F
       ) throws IOException {
     super.initialize(uri, conf);
     setConf(conf);
-    /** set user pattern based on configuration file */
-    UserParam.setUserPattern(conf);
     initializeTokenAspect();
     initializeConnectionFactory(conf);
 

Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/resources/UserParam.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/resources/UserParam.java?rev=1547971&r1=1547970&r2=1547971&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/resources/UserParam.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/resources/UserParam.java
Thu Dec  5 00:06:20 2013
@@ -17,12 +17,8 @@
  */
 package org.apache.hadoop.hdfs.web.resources;
 
-import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.security.UserGroupInformation;
-import static org.apache.hadoop.hdfs.web.WebHdfsConfigKeys.USER_PATTERN_KEY;
-import static org.apache.hadoop.hdfs.web.WebHdfsConfigKeys.USER_PATTERN_DEFAULT;
-import com.google.common.annotations.VisibleForTesting;
- 
+
 import java.text.MessageFormat;
 import java.util.regex.Pattern;
 
@@ -33,29 +29,8 @@ public class UserParam extends StringPar
   /** Default parameter value. */
   public static final String DEFAULT = "";
 
-  private static String userPattern = null;
-  private static Domain domain = null;
-
-  static {
-      setUserPattern(USER_PATTERN_DEFAULT);
-  }
-
-  @VisibleForTesting
-  public static String getUserPattern() {
-    return userPattern;
-  }
-
-  @VisibleForTesting
-  public static void setUserPattern(String pattern) {
-    userPattern = pattern;
-    Pattern pt = Pattern.compile(userPattern);
-    domain = new Domain(NAME, pt);
-  }
-
-  public static void setUserPattern(Configuration conf) {
-    String pattern = conf.get(USER_PATTERN_KEY, USER_PATTERN_DEFAULT);
-    setUserPattern(pattern);
-  }
+  private static final Domain DOMAIN = new Domain(NAME,
+    Pattern.compile("^[A-Za-z_][A-Za-z0-9._-]*[$]?$"));
 
   private static String validateLength(String str) {
     if (str == null) {
@@ -75,7 +50,7 @@ public class UserParam extends StringPar
    * @param str a string representation of the parameter value.
    */
   public UserParam(final String str) {
-    super(domain, str == null || str.equals(DEFAULT)? null : validateLength(str));
+    super(DOMAIN, str == null || str.equals(DEFAULT)? null : validateLength(str));
   }
 
   /**
@@ -89,4 +64,4 @@ public class UserParam extends StringPar
   public String getName() {
     return NAME;
   }
-}
+}
\ No newline at end of file

Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHDFS.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHDFS.java?rev=1547971&r1=1547970&r2=1547971&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHDFS.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHDFS.java
Thu Dec  5 00:06:20 2013
@@ -38,7 +38,6 @@ import org.apache.hadoop.hdfs.HdfsConfig
 import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.hadoop.hdfs.TestDFSClientRetries;
 import org.apache.hadoop.hdfs.server.namenode.web.resources.NamenodeWebHdfsMethods;
-import org.apache.hadoop.hdfs.web.WebHdfsConfigKeys;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.log4j.Level;
 import org.junit.Assert;
@@ -262,34 +261,6 @@ public class TestWebHDFS {
     }
   }
 
-  @Test(timeout=300000)
-  public void testNumericalUserName() throws Exception {
-    final Configuration conf = WebHdfsTestUtil.createConf();
-    conf.set(WebHdfsConfigKeys.USER_PATTERN_KEY, "^[A-Za-z0-9_][A-Za-z0-9._-]*[$]?$");
-    final MiniDFSCluster cluster =
-        new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
-    try {
-      cluster.waitActive();
-      WebHdfsTestUtil.getWebHdfsFileSystem(conf, WebHdfsFileSystem.SCHEME)
-          .setPermission(new Path("/"),
-              new FsPermission(FsAction.ALL, FsAction.ALL, FsAction.ALL));
-
-      UserGroupInformation.createUserForTesting("123", new String[]{"my-group"})
-        .doAs(new PrivilegedExceptionAction<Void>() {
-          @Override
-          public Void run() throws IOException, URISyntaxException {
-            FileSystem fs = WebHdfsTestUtil.getWebHdfsFileSystem(conf,
-                WebHdfsFileSystem.SCHEME);
-            Path d = new Path("/my-dir");
-            Assert.assertTrue(fs.mkdirs(d));
-            return null;
-          }
-        });
-    } finally {
-      cluster.shutdown();
-    }
-  }
-
   /**
    * WebHdfs should be enabled by default after HDFS-5532
    * 

Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/resources/TestParam.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/resources/TestParam.java?rev=1547971&r1=1547970&r2=1547971&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/resources/TestParam.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/resources/TestParam.java
Thu Dec  5 00:06:20 2013
@@ -285,19 +285,4 @@ public class TestParam {
       Assert.assertEquals(expected, computed.getValue());
     }
   }
-
-  @Test
-  public void testUserNameOkAfterResettingPattern() {
-    String oldPattern = UserParam.getUserPattern();
-    String newPattern = "^[A-Za-z0-9_][A-Za-z0-9._-]*[$]?$";
-
-    UserParam.setUserPattern(newPattern);
-
-    UserParam userParam = new UserParam("1x");
-    assertNotNull(userParam.getValue());
-    userParam = new UserParam("123");
-    assertNotNull(userParam.getValue());
-
-    UserParam.setUserPattern(oldPattern);
-  }
 }



Mime
View raw message