hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1125601 - in /hadoop/hdfs/trunk: ./ 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/hdfs/tools/
Date Sat, 21 May 2011 00:14:54 GMT
Author: todd
Date: Sat May 21 00:14:54 2011
New Revision: 1125601

URL: http://svn.apache.org/viewvc?rev=1125601&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/trunk/CHANGES.txt
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/fs/Hdfs.java
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/HdfsConfiguration.java
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/DFSck.java
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/GetConf.java
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/GetGroups.java

Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=1125601&r1=1125600&r2=1125601&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Sat May 21 00:14:54 2011
@@ -1041,6 +1041,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)
 
     HDFS-1952. FSEditLog.open() appears to succeed even if all EDITS
     directories fail. (Andrew Wang via todd)

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/fs/Hdfs.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/fs/Hdfs.java?rev=1125601&r1=1125600&r2=1125601&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/fs/Hdfs.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/fs/Hdfs.java Sat May 21 00:14:54 2011
@@ -35,6 +35,7 @@ import org.apache.hadoop.fs.permission.F
 import org.apache.hadoop.hdfs.CorruptFileBlockIterator;
 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;
@@ -56,8 +57,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/trunk/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java?rev=1125601&r1=1125600&r2=1125601&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java Sat May 21
00:14:54 2011
@@ -81,8 +81,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/trunk/src/java/org/apache/hadoop/hdfs/HdfsConfiguration.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/HdfsConfiguration.java?rev=1125601&r1=1125600&r2=1125601&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/HdfsConfiguration.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/HdfsConfiguration.java Sat May 21 00:14:54
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/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java?rev=1125601&r1=1125600&r2=1125601&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java Sat May
21 00:14:54 2011
@@ -172,8 +172,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/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java?rev=1125601&r1=1125600&r2=1125601&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java Sat May
21 00:14:54 2011
@@ -142,8 +142,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();
   }
   
   /**

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java?rev=1125601&r1=1125600&r2=1125601&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java
(original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java
Sat May 21 00:14:54 2011
@@ -78,8 +78,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/trunk/src/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java?rev=1125601&r1=1125600&r2=1125601&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java Sat May 21 00:14:54
2011
@@ -38,6 +38,7 @@ import org.apache.hadoop.hdfs.DFSClient;
 import org.apache.hadoop.hdfs.DFSConfigKeys;
 import org.apache.hadoop.hdfs.DFSUtil;
 import org.apache.hadoop.hdfs.DistributedFileSystem;
+import org.apache.hadoop.hdfs.HdfsConfiguration;
 import org.apache.hadoop.hdfs.protocol.ClientDatanodeProtocol;
 import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
 import org.apache.hadoop.hdfs.protocol.FSConstants;
@@ -61,8 +62,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/trunk/src/java/org/apache/hadoop/hdfs/tools/DFSck.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/DFSck.java?rev=1125601&r1=1125600&r2=1125601&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/DFSck.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/DFSck.java Sat May 21 00:14:54
2011
@@ -72,8 +72,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;

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/GetConf.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/GetConf.java?rev=1125601&r1=1125600&r2=1125601&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/GetConf.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/GetConf.java Sat May 21 00:14:54
2011
@@ -99,8 +99,7 @@ public class GetConf extends Configured 
   
   static final String USAGE;
   static {
-    Configuration.addDefaultResource("hdfs-default.xml");
-    Configuration.addDefaultResource("hdfs-site.xml");
+    HdfsConfiguration.init();
     
     /* Initialize USAGE based on Command values */
     StringBuilder usage = new StringBuilder(DESCRIPTION);

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/GetGroups.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/GetGroups.java?rev=1125601&r1=1125600&r2=1125601&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/GetGroups.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/GetGroups.java Sat May 21 00:14:54
2011
@@ -32,11 +32,11 @@ import org.apache.hadoop.util.ToolRunner
  * belongs to.
  */
 public class GetGroups extends GetGroupsBase {
-  
-  static {
-    Configuration.addDefaultResource("hdfs-default.xml");
-    Configuration.addDefaultResource("hdfs-site.xml");
+
+  static{
+    HdfsConfiguration.init();
   }
+
   
   GetGroups(Configuration conf) {
     super(conf);



Mime
View raw message