hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1100044 - in /hadoop/common/trunk: ./ src/java/org/apache/hadoop/fs/ src/test/core/org/apache/hadoop/fs/
Date Fri, 06 May 2011 04:26:30 GMT
Author: eli
Date: Fri May  6 04:26:30 2011
New Revision: 1100044

URL: http://svn.apache.org/viewvc?rev=1100044&view=rev
Log:
HADOOP-7245. FsConfig should use constants in CommonConfigurationKeys. Contributed by Tom
White

Modified:
    hadoop/common/trunk/CHANGES.txt
    hadoop/common/trunk/src/java/org/apache/hadoop/fs/CommonConfigurationKeysPublic.java
    hadoop/common/trunk/src/java/org/apache/hadoop/fs/FsConfig.java
    hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestLocal_S3FileContextURI.java
    hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestS3_LocalFileContextURI.java

Modified: hadoop/common/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=1100044&r1=1100043&r2=1100044&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Fri May  6 04:26:30 2011
@@ -622,6 +622,9 @@ Release 0.22.0 - Unreleased
     HADOOP-7184. Remove deprecated config local.cache.size from
     core-default.xml (todd)
 
+    HADOOP-7245. FsConfig should use constants in CommonConfigurationKeys.
+    (tomwhite via eli)
+
 Release 0.21.1 - Unreleased
 
   IMPROVEMENTS

Modified: hadoop/common/trunk/src/java/org/apache/hadoop/fs/CommonConfigurationKeysPublic.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/fs/CommonConfigurationKeysPublic.java?rev=1100044&r1=1100043&r2=1100044&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/fs/CommonConfigurationKeysPublic.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/fs/CommonConfigurationKeysPublic.java Fri
May  6 04:26:30 2011
@@ -118,6 +118,11 @@ public class CommonConfigurationKeysPubl
   /** Default value for IO_SEQFILE_COMPRESS_BLOCKSIZE_KEY */
   public static final int     IO_SEQFILE_COMPRESS_BLOCKSIZE_DEFAULT = 1000000;
   /** See <a href="{@docRoot}/../core-default.html">core-default.xml</a> */
+  public static final String  IO_FILE_BUFFER_SIZE_KEY =
+    "io.file.buffer.size";
+  /** Default value for IO_FILE_BUFFER_SIZE_KEY */
+  public static final int     IO_FILE_BUFFER_SIZE_DEFAULT = 4096;
+  /** See <a href="{@docRoot}/../core-default.html">core-default.xml</a> */
   public static final String  IO_SKIP_CHECKSUM_ERRORS_KEY =
     "io.skip.checksum.errors";
   /** Default value for IO_SKIP_CHECKSUM_ERRORS_KEY */

Modified: hadoop/common/trunk/src/java/org/apache/hadoop/fs/FsConfig.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/fs/FsConfig.java?rev=1100044&r1=1100043&r2=1100044&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/fs/FsConfig.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/fs/FsConfig.java Fri May  6 04:26:30 2011
@@ -17,6 +17,13 @@
  */
 package org.apache.hadoop.fs;
 
+import static org.apache.hadoop.fs.CommonConfigurationKeys.FS_HOME_DIR_DEFAULT;
+import static org.apache.hadoop.fs.CommonConfigurationKeys.FS_HOME_DIR_KEY;
+import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.FS_DEFAULT_NAME_DEFAULT;
+import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY;
+import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.IO_FILE_BUFFER_SIZE_DEFAULT;
+import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.IO_FILE_BUFFER_SIZE_KEY;
+
 import java.net.URI;
 
 import org.apache.hadoop.conf.Configuration;
@@ -37,30 +44,24 @@ final class FsConfig {
   
   
   // The Keys
-  static final String FS_DEFAULT_NAME_KEY = "fs.default.name";
-  static final String FS_HOME_DIR_ROOT_KEY = "fs.homeDir";
   static final String FS_REPLICATION_FACTOR_KEY = "dfs.replication";
   static final String FS_BLOCK_SIZE_KEY = "dfs.block.size";
-  static final String IO_BUFFER_SIZE_KEY ="io.file.buffer.size";
 
 
   // The default values
   // Default values of SERVER_DEFAULT(-1) implies use the ones from
   // the target file system where files are created.
-  static final String FS_DEFAULT_NAME = "file:///";
-  static final String FS_HOME_DIR_ROOT = "/user"; // relative to FS_DEFAULT
   static final short FS_DEFAULT_REPLICATION_FACTOR = 3;
   static final long FS_DEFAULT_BLOCK_SIZE = 32 * 1024 * 1024;
-  static final int IO_BUFFER_SIZE =4096;
   
   
   
   public static String getDefaultFsURI(final Configuration conf) {
-    return conf.get(FS_DEFAULT_NAME_KEY, FS_DEFAULT_NAME);
+    return conf.get(FS_DEFAULT_NAME_KEY, FS_DEFAULT_NAME_DEFAULT);
   }
   
   public static String getHomeDir(final Configuration conf) {
-    return conf.get(FS_HOME_DIR_ROOT_KEY, FS_HOME_DIR_ROOT);
+    return conf.get(FS_HOME_DIR_KEY, FS_HOME_DIR_DEFAULT);
   }
   
   public static short getDefaultReplicationFactor(final Configuration conf) {
@@ -74,7 +75,7 @@ final class FsConfig {
 
   
   public static int getDefaultIOBuffersize(final Configuration conf) {
-    return conf.getInt(IO_BUFFER_SIZE_KEY, IO_BUFFER_SIZE);
+    return conf.getInt(IO_FILE_BUFFER_SIZE_KEY, IO_FILE_BUFFER_SIZE_DEFAULT);
   }
   
   public static Class<?> getImplClass(URI uri, Configuration conf) {
@@ -95,7 +96,7 @@ final class FsConfig {
   }
   
   public static void setHomeDir(final Configuration conf, String path) {
-    conf.set(FS_HOME_DIR_ROOT_KEY, path);
+    conf.set(FS_HOME_DIR_KEY, path);
   }
   
   public static void setDefaultReplicationFactor(final Configuration conf,
@@ -108,6 +109,6 @@ final class FsConfig {
   }
   
   public static void setDefaultIOBuffersize(final Configuration conf, int bs) {
-    conf.setInt(IO_BUFFER_SIZE_KEY, bs);
+    conf.setInt(IO_FILE_BUFFER_SIZE_KEY, bs);
   }
 }

Modified: hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestLocal_S3FileContextURI.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestLocal_S3FileContextURI.java?rev=1100044&r1=1100043&r2=1100044&view=diff
==============================================================================
--- hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestLocal_S3FileContextURI.java
(original)
+++ hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestLocal_S3FileContextURI.java
Fri May  6 04:26:30 2011
@@ -18,7 +18,7 @@
 
 package org.apache.hadoop.fs;
 
-
+import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.FS_DEFAULT_NAME_DEFAULT;
 import org.apache.hadoop.conf.Configuration;
 import org.junit.Before;
 
@@ -29,7 +29,7 @@ public class TestLocal_S3FileContextURI 
     Configuration S3Conf = new Configuration();
     Configuration localConf = new Configuration();
 
-    S3Conf.set(FsConfig.FS_DEFAULT_NAME, S3Conf.get("test.fs.s3.name"));
+    S3Conf.set(FS_DEFAULT_NAME_DEFAULT, S3Conf.get("test.fs.s3.name"));
     fc1 = FileContext.getFileContext(S3Conf);
     fc2 = FileContext.getFileContext(localConf);
   }

Modified: hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestS3_LocalFileContextURI.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestS3_LocalFileContextURI.java?rev=1100044&r1=1100043&r2=1100044&view=diff
==============================================================================
--- hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestS3_LocalFileContextURI.java
(original)
+++ hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestS3_LocalFileContextURI.java
Fri May  6 04:26:30 2011
@@ -18,7 +18,7 @@
 
 package org.apache.hadoop.fs;
 
-
+import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.FS_DEFAULT_NAME_DEFAULT;
 import org.apache.hadoop.conf.Configuration;
 import org.junit.Before;
 
@@ -31,8 +31,7 @@ public class TestS3_LocalFileContextURI 
     fc2 = FileContext.getFileContext(localConf);
 
     Configuration s3conf = new Configuration();
-    s3conf.set(FsConfig.FS_DEFAULT_NAME, s3conf.get("test.fs.s3.name"));
+    s3conf.set(FS_DEFAULT_NAME_DEFAULT, s3conf.get("test.fs.s3.name"));
     fc1 = FileContext.getFileContext(s3conf);
-
   }
 }



Mime
View raw message