HDFS-4416. Rename dfs.datanode.domain.socket.path to dfs.domain.socket.path. Contributed by Colin Patrick McCabe.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-347@1436568 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
52c5b8ea9f
commit
89bd14913a
|
@ -744,6 +744,21 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of the <code>name</code> property as a trimmed <code>String</code>,
|
||||
* <code>defaultVal</code> if no such property exists.
|
||||
* See @{Configuration#getTrimmed} for more details.
|
||||
*
|
||||
* @param name the property name.
|
||||
* @param defaultVal the property default value.
|
||||
* @return the value of the <code>name</code> or defaultVal
|
||||
* if it is not set.
|
||||
*/
|
||||
public String getTrimmed(String name, String defaultValue) {
|
||||
String ret = getTrimmed(name);
|
||||
return ret == null ? defaultValue : ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of the <code>name</code> property, without doing
|
||||
* <a href="#VariableExpansion">variable expansion</a>.If the key is
|
||||
|
|
|
@ -119,7 +119,7 @@ public class DomainSocket implements Closeable {
|
|||
|
||||
/**
|
||||
* Given a path and a port, compute the effective path by replacing
|
||||
* occurrences of __PORT__ with the port. This is mainly to make it
|
||||
* occurrences of _PORT with the port. This is mainly to make it
|
||||
* possible to run multiple DataNodes locally for testing purposes.
|
||||
*
|
||||
* @param path The source path
|
||||
|
@ -128,7 +128,7 @@ public class DomainSocket implements Closeable {
|
|||
* @return The effective path
|
||||
*/
|
||||
public static String getEffectivePath(String path, int port) {
|
||||
return path.replace("__PORT__", String.valueOf(port));
|
||||
return path.replace("_PORT", String.valueOf(port));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -91,7 +91,7 @@ public class TestDomainSocket {
|
|||
@Test(timeout=180000)
|
||||
public void testSocketPathSetGet() throws IOException {
|
||||
Assert.assertEquals("/var/run/hdfs/sock.100",
|
||||
DomainSocket.getEffectivePath("/var/run/hdfs/sock.__PORT__", 100));
|
||||
DomainSocket.getEffectivePath("/var/run/hdfs/sock._PORT", 100));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,3 +27,6 @@ HDFS-4402. Some small DomainSocket fixes: avoid findbugs warning, change log lev
|
|||
(Colin Patrick McCabe via todd)
|
||||
|
||||
HDFS-4418. increase default FileInputStreamCache size (todd)
|
||||
|
||||
HDFS-4416. Rename dfs.datanode.domain.socket.path to dfs.domain.socket.path
|
||||
(Colin Patrick McCabe via todd)
|
||||
|
|
|
@ -291,7 +291,8 @@ public class DFSClient implements java.io.Closeable {
|
|||
getFileBlockStorageLocationsTimeout = conf.getInt(
|
||||
DFSConfigKeys.DFS_CLIENT_FILE_BLOCK_STORAGE_LOCATIONS_TIMEOUT,
|
||||
DFSConfigKeys.DFS_CLIENT_FILE_BLOCK_STORAGE_LOCATIONS_TIMEOUT_DEFAULT);
|
||||
domainSocketPath = conf.get(DFSConfigKeys.DFS_DATANODE_DOMAIN_SOCKET_PATH_KEY);
|
||||
domainSocketPath = conf.getTrimmed(DFSConfigKeys.DFS_DOMAIN_SOCKET_PATH_KEY,
|
||||
DFSConfigKeys.DFS_DOMAIN_SOCKET_PATH_DEFAULT);
|
||||
skipShortCircuitChecksums = conf.getBoolean(
|
||||
DFSConfigKeys.DFS_CLIENT_READ_SHORTCIRCUIT_SKIP_CHECKSUM_KEY,
|
||||
DFSConfigKeys.DFS_CLIENT_READ_SHORTCIRCUIT_SKIP_CHECKSUM_DEFAULT);
|
||||
|
|
|
@ -399,7 +399,8 @@ public class DFSConfigKeys extends CommonConfigurationKeys {
|
|||
public static final String DFS_WEB_AUTHENTICATION_KERBEROS_KEYTAB_KEY = "dfs.web.authentication.kerberos.keytab";
|
||||
|
||||
public static final String DFS_BLOCK_LOCAL_PATH_ACCESS_USER_KEY = "dfs.block.local-path-access.user";
|
||||
public static final String DFS_DATANODE_DOMAIN_SOCKET_PATH_KEY = "dfs.datanode.domain.socket.path";
|
||||
public static final String DFS_DOMAIN_SOCKET_PATH_KEY = "dfs.domain.socket.path";
|
||||
public static final String DFS_DOMAIN_SOCKET_PATH_DEFAULT = "";
|
||||
|
||||
// HA related configuration
|
||||
public static final String DFS_HA_NAMENODES_KEY_PREFIX = "dfs.ha.namenodes";
|
||||
|
|
|
@ -58,9 +58,9 @@ class DomainSocketFactory {
|
|||
feature = "UNIX domain socket data traffic";
|
||||
}
|
||||
if (feature != null) {
|
||||
if (conf.domainSocketPath == null) {
|
||||
if (conf.domainSocketPath.isEmpty()) {
|
||||
LOG.warn(feature + " is disabled because you have not set " +
|
||||
DFSConfigKeys.DFS_DATANODE_DOMAIN_SOCKET_PATH_KEY);
|
||||
DFSConfigKeys.DFS_DOMAIN_SOCKET_PATH_KEY);
|
||||
} else if (DomainSocket.getLoadingFailureReason() != null) {
|
||||
LOG.warn(feature + " is disabled because " +
|
||||
DomainSocket.getLoadingFailureReason());
|
||||
|
|
|
@ -572,13 +572,14 @@ public class DataNode extends Configured
|
|||
static DomainPeerServer getDomainPeerServer(Configuration conf,
|
||||
int port) throws IOException {
|
||||
String domainSocketPath =
|
||||
conf.get(DFSConfigKeys.DFS_DATANODE_DOMAIN_SOCKET_PATH_KEY);
|
||||
if (domainSocketPath == null) {
|
||||
conf.getTrimmed(DFSConfigKeys.DFS_DOMAIN_SOCKET_PATH_KEY,
|
||||
DFSConfigKeys.DFS_DOMAIN_SOCKET_PATH_DEFAULT);
|
||||
if (domainSocketPath.isEmpty()) {
|
||||
if (conf.getBoolean(DFSConfigKeys.DFS_CLIENT_READ_SHORTCIRCUIT_KEY,
|
||||
DFSConfigKeys.DFS_CLIENT_READ_SHORTCIRCUIT_DEFAULT)) {
|
||||
LOG.warn("Although short-circuit local reads are configured, " +
|
||||
"they are disabled because you didn't configure " +
|
||||
DFSConfigKeys.DFS_DATANODE_DOMAIN_SOCKET_PATH_KEY);
|
||||
DFSConfigKeys.DFS_DOMAIN_SOCKET_PATH_KEY);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1197,4 +1197,15 @@
|
|||
</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>dfs.domain.socket.path</name>
|
||||
<value></value>
|
||||
<description>
|
||||
Optional. This is a path to a UNIX domain socket that will be used for
|
||||
communication between the DataNode and local HDFS clients.
|
||||
If the string "_PORT" is present in this path, it will be replaced by the
|
||||
TCP port of the DataNode.
|
||||
</description>
|
||||
</property>
|
||||
|
||||
</configuration>
|
||||
|
|
|
@ -35,7 +35,7 @@ public class TestParallelShortCircuitRead extends TestParallelReadUtil {
|
|||
if (DomainSocket.getLoadingFailureReason() != null) return;
|
||||
sockDir = new TemporarySocketDirectory();
|
||||
HdfsConfiguration conf = new HdfsConfiguration();
|
||||
conf.set(DFSConfigKeys.DFS_DATANODE_DOMAIN_SOCKET_PATH_KEY,
|
||||
conf.set(DFSConfigKeys.DFS_DOMAIN_SOCKET_PATH_KEY,
|
||||
new File(sockDir.getDir(), "TestParallelLocalRead.%d.sock").getAbsolutePath());
|
||||
conf.setBoolean(DFSConfigKeys.DFS_CLIENT_READ_SHORTCIRCUIT_KEY, true);
|
||||
conf.setBoolean(DFSConfigKeys.
|
||||
|
|
|
@ -35,7 +35,7 @@ public class TestParallelShortCircuitReadNoChecksum extends TestParallelReadUtil
|
|||
if (DomainSocket.getLoadingFailureReason() != null) return;
|
||||
sockDir = new TemporarySocketDirectory();
|
||||
HdfsConfiguration conf = new HdfsConfiguration();
|
||||
conf.set(DFSConfigKeys.DFS_DATANODE_DOMAIN_SOCKET_PATH_KEY,
|
||||
conf.set(DFSConfigKeys.DFS_DOMAIN_SOCKET_PATH_KEY,
|
||||
new File(sockDir.getDir(), "TestParallelLocalRead.%d.sock").getAbsolutePath());
|
||||
conf.setBoolean(DFSConfigKeys.DFS_CLIENT_READ_SHORTCIRCUIT_KEY, true);
|
||||
conf.setBoolean(DFSConfigKeys.
|
||||
|
|
|
@ -35,7 +35,7 @@ public class TestParallelUnixDomainRead extends TestParallelReadUtil {
|
|||
if (DomainSocket.getLoadingFailureReason() != null) return;
|
||||
sockDir = new TemporarySocketDirectory();
|
||||
HdfsConfiguration conf = new HdfsConfiguration();
|
||||
conf.set(DFSConfigKeys.DFS_DATANODE_DOMAIN_SOCKET_PATH_KEY,
|
||||
conf.set(DFSConfigKeys.DFS_DOMAIN_SOCKET_PATH_KEY,
|
||||
new File(sockDir.getDir(), "TestParallelLocalRead.%d.sock").getAbsolutePath());
|
||||
conf.setBoolean(DFSConfigKeys.DFS_CLIENT_READ_SHORTCIRCUIT_KEY, false);
|
||||
DomainSocket.disableBindPathValidation();
|
||||
|
|
|
@ -193,9 +193,9 @@ public class TestShortCircuitLocalRead {
|
|||
conf.setBoolean(DFSConfigKeys.DFS_CLIENT_READ_SHORTCIRCUIT_KEY, true);
|
||||
conf.setBoolean(DFSConfigKeys.DFS_CLIENT_READ_SHORTCIRCUIT_SKIP_CHECKSUM_KEY,
|
||||
ignoreChecksum);
|
||||
conf.set(DFSConfigKeys.DFS_DATANODE_DOMAIN_SOCKET_PATH_KEY,
|
||||
conf.set(DFSConfigKeys.DFS_DOMAIN_SOCKET_PATH_KEY,
|
||||
new File(sockDir.getDir(),
|
||||
"TestShortCircuitLocalRead.__PORT__.sock").getAbsolutePath());
|
||||
"TestShortCircuitLocalRead._PORT.sock").getAbsolutePath());
|
||||
if (simulatedStorage) {
|
||||
SimulatedFSDataset.setFactory(conf);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue