hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1125600 - in /hadoop/hdfs/branches/branch-0.22: ./ src/java/org/apache/hadoop/fs/ src/java/org/apache/hadoop/hdfs/ src/java/org/apache/hadoop/hdfs/server/datanode/ src/java/org/apache/hadoop/hdfs/server/namenode/ src/java/org/apache/hadoop...
Date Sat, 21 May 2011 00:13:23 GMT
Author: todd
Date: Sat May 21 00:13:23 2011
New Revision: 1125600

URL: http://svn.apache.org/viewvc?rev=1125600&view=rev
Log:
HDFS-1932. Ensure that HDFS configuration deprecations are set up in every spot that HDFS
configurations are loaded. Contributed by Jolly Chen.

Modified:
    hadoop/hdfs/branches/branch-0.22/CHANGES.txt
    hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/fs/Hdfs.java
    hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java
    hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/HdfsConfiguration.java
    hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
    hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java
    hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java
    hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java
    hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/tools/DFSck.java

Modified: hadoop/hdfs/branches/branch-0.22/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.22/CHANGES.txt?rev=1125600&r1=1125599&r2=1125600&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.22/CHANGES.txt (original)
+++ hadoop/hdfs/branches/branch-0.22/CHANGES.txt Sat May 21 00:13:23 2011
@@ -525,6 +525,9 @@ Release 0.22.0 - Unreleased
     hard-coded value for its default. (Joey Echeverria via todd)
 
     HDFS-1575. Viewing block from web UI is broken. (Aaron T. Myers via todd)
+    
+    HDFS-1932. Ensure that HDFS configuration deprecations are set up in every
+    spot that HDFS configurations are loaded. (Jolly Chen via todd)
 
 Release 0.21.1 - Unreleased
 

Modified: hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/fs/Hdfs.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/fs/Hdfs.java?rev=1125600&r1=1125599&r2=1125600&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/fs/Hdfs.java (original)
+++ hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/fs/Hdfs.java Sat May 21 00:13:23
2011
@@ -32,6 +32,7 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.hdfs.DFSClient;
 import org.apache.hadoop.hdfs.DFSUtil;
+import org.apache.hadoop.hdfs.HdfsConfiguration;
 import org.apache.hadoop.hdfs.protocol.DirectoryListing;
 import org.apache.hadoop.hdfs.protocol.FSConstants;
 import org.apache.hadoop.hdfs.protocol.HdfsFileStatus;
@@ -48,8 +49,7 @@ public class Hdfs extends AbstractFileSy
   private boolean verifyChecksum = true;
 
   static {
-    Configuration.addDefaultResource("hdfs-default.xml");
-    Configuration.addDefaultResource("hdfs-site.xml");
+    HdfsConfiguration.init();
   }
 
   /**

Modified: hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java?rev=1125600&r1=1125599&r2=1125600&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java
(original)
+++ hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java
Sat May 21 00:13:23 2011
@@ -80,8 +80,7 @@ public class DistributedFileSystem exten
   private boolean verifyChecksum = true;
   
   static{
-    Configuration.addDefaultResource("hdfs-default.xml");
-    Configuration.addDefaultResource("hdfs-site.xml");
+    HdfsConfiguration.init();
   }
 
   public DistributedFileSystem() {

Modified: hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/HdfsConfiguration.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/HdfsConfiguration.java?rev=1125600&r1=1125599&r2=1125600&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/HdfsConfiguration.java
(original)
+++ hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/HdfsConfiguration.java
Sat May 21 00:13:23 2011
@@ -29,6 +29,11 @@ import org.apache.hadoop.classification.
 public class HdfsConfiguration extends Configuration {
   static {
     addDeprecatedKeys();
+
+    // adds the default resources
+    Configuration.addDefaultResource("hdfs-default.xml");
+    Configuration.addDefaultResource("hdfs-site.xml");
+
   }
 
   public HdfsConfiguration() {
@@ -42,6 +47,20 @@ public class HdfsConfiguration extends C
   public HdfsConfiguration(Configuration conf) {
     super(conf);
   }
+  
+  /**
+   * This method is here so that when invoked, HdfsConfiguration is class-loaded if
+   * it hasn't already been previously loaded.  Upon loading the class, the static 
+   * initializer block above will be executed to add the deprecated keys and to add
+   * the default resources.   It is safe for this method to be called multiple times 
+   * as the static initializer block will only get invoked once.
+   * 
+   * This replaces the previously, dangerous practice of other classes calling
+   * Configuration.addDefaultResource("hdfs-default.xml") directly without loading 
+   * HdfsConfiguration class first, thereby skipping the key deprecation
+   */
+  public static void init() {
+  }
 
   private static void deprecate(String oldKey, String newKey) {
     Configuration.addDeprecation(oldKey, new String[]{newKey});

Modified: hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java?rev=1125600&r1=1125599&r2=1125600&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
(original)
+++ hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
Sat May 21 00:13:23 2011
@@ -168,8 +168,7 @@ public class DataNode extends Configured
   public static final Log LOG = LogFactory.getLog(DataNode.class);
   
   static{
-    Configuration.addDefaultResource("hdfs-default.xml");
-    Configuration.addDefaultResource("hdfs-site.xml");
+    HdfsConfiguration.init();
   }
 
   public static final String DN_CLIENTTRACE_FORMAT =

Modified: hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java?rev=1125600&r1=1125599&r2=1125600&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java
(original)
+++ hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java
Sat May 21 00:13:23 2011
@@ -141,8 +141,7 @@ import org.apache.hadoop.util.StringUtil
 @InterfaceAudience.Private
 public class NameNode implements NamenodeProtocols, FSConstants {
   static{
-    Configuration.addDefaultResource("hdfs-default.xml");
-    Configuration.addDefaultResource("hdfs-site.xml");
+    HdfsConfiguration.init();
   }
   
   public long getProtocolVersion(String protocol, 

Modified: hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java?rev=1125600&r1=1125599&r2=1125600&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java
(original)
+++ hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java
Sat May 21 00:13:23 2011
@@ -75,8 +75,7 @@ import org.apache.hadoop.util.StringUtil
 public class SecondaryNameNode implements Runnable {
     
   static{
-    Configuration.addDefaultResource("hdfs-default.xml");
-    Configuration.addDefaultResource("hdfs-site.xml");
+    HdfsConfiguration.init();
   }
   public static final Log LOG = 
     LogFactory.getLog(SecondaryNameNode.class.getName());

Modified: hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java?rev=1125600&r1=1125599&r2=1125600&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java (original)
+++ hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java Sat
May 21 00:13:23 2011
@@ -36,6 +36,7 @@ import org.apache.hadoop.fs.shell.Comman
 import org.apache.hadoop.hdfs.DFSClient;
 import org.apache.hadoop.hdfs.DFSConfigKeys;
 import org.apache.hadoop.hdfs.DistributedFileSystem;
+import org.apache.hadoop.hdfs.HdfsConfiguration;
 import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
 import org.apache.hadoop.hdfs.protocol.FSConstants;
 import org.apache.hadoop.hdfs.protocol.FSConstants.DatanodeReportType;
@@ -58,8 +59,7 @@ import org.apache.hadoop.util.ToolRunner
 public class DFSAdmin extends FsShell {
 
   static{
-    Configuration.addDefaultResource("hdfs-default.xml");
-    Configuration.addDefaultResource("hdfs-site.xml");
+    HdfsConfiguration.init();
   }
 
   /**

Modified: hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/tools/DFSck.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/tools/DFSck.java?rev=1125600&r1=1125599&r2=1125600&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/tools/DFSck.java (original)
+++ hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/tools/DFSck.java Sat
May 21 00:13:23 2011
@@ -66,8 +66,7 @@ import org.apache.hadoop.util.ToolRunner
 @InterfaceAudience.Private
 public class DFSck extends Configured implements Tool {
   static{
-    Configuration.addDefaultResource("hdfs-default.xml");
-    Configuration.addDefaultResource("hdfs-site.xml");
+    HdfsConfiguration.init();
   }
 
   private final UserGroupInformation ugi;
@@ -255,8 +254,7 @@ public class DFSck extends Configured im
   }
 
   static{
-    Configuration.addDefaultResource("hdfs-default.xml");
-    Configuration.addDefaultResource("hdfs-site.xml");
+    HdfsConfiguration.init();
   }
   
   public static void main(String[] args) throws Exception {



Mime
View raw message