HADOOP-7245. FsConfig should use constants in CommonConfigurationKeys. Contributed by Tom White
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1100044 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f1c74df922
commit
f489f9514d
@ -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
|
||||
|
@ -118,6 +118,11 @@ public class CommonConfigurationKeysPublic {
|
||||
/** 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 */
|
||||
|
@ -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 @@ private 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 @@ public static long getDefaultBlockSize(final Configuration conf) {
|
||||
|
||||
|
||||
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 @@ public static void setDefaultFS(final Configuration conf, String uri) {
|
||||
}
|
||||
|
||||
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 @@ public static void setDefaultBlockSize(final Configuration conf, long bs) {
|
||||
}
|
||||
|
||||
public static void setDefaultIOBuffersize(final Configuration conf, int bs) {
|
||||
conf.setInt(IO_BUFFER_SIZE_KEY, bs);
|
||||
conf.setInt(IO_FILE_BUFFER_SIZE_KEY, bs);
|
||||
}
|
||||
}
|
||||
|
@ -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 void setUp() throws Exception {
|
||||
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);
|
||||
}
|
||||
|
@ -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 void setUp() throws Exception {
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user