HDFS-3351. NameNode#initializeGenericKeys should always set fs.defaultFS regardless of whether HA or Federation is enabled. Contributed by Aaron T. Myers.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1333299 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cbc2424290
commit
470b1197be
|
@ -589,6 +589,9 @@ Release 2.0.0 - UNRELEASED
|
||||||
HDFS-3330. If GetImageServlet throws an Error or RTE, response should not
|
HDFS-3330. If GetImageServlet throws an Error or RTE, response should not
|
||||||
have HTTP "OK" status. (todd)
|
have HTTP "OK" status. (todd)
|
||||||
|
|
||||||
|
HDFS-3351. NameNode#initializeGenericKeys should always set fs.defaultFS
|
||||||
|
regardless of whether HA or Federation is enabled. (atm)
|
||||||
|
|
||||||
BREAKDOWN OF HDFS-1623 SUBTASKS
|
BREAKDOWN OF HDFS-1623 SUBTASKS
|
||||||
|
|
||||||
HDFS-2179. Add fencing framework and mechanisms for NameNode HA. (todd)
|
HDFS-2179. Add fencing framework and mechanisms for NameNode HA. (todd)
|
||||||
|
|
|
@ -1130,11 +1130,8 @@ public class NameNode {
|
||||||
*/
|
*/
|
||||||
public static void initializeGenericKeys(Configuration conf,
|
public static void initializeGenericKeys(Configuration conf,
|
||||||
String nameserviceId, String namenodeId) {
|
String nameserviceId, String namenodeId) {
|
||||||
if ((nameserviceId == null || nameserviceId.isEmpty()) &&
|
if ((nameserviceId != null && !nameserviceId.isEmpty()) ||
|
||||||
(namenodeId == null || namenodeId.isEmpty())) {
|
(namenodeId != null && !namenodeId.isEmpty())) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nameserviceId != null) {
|
if (nameserviceId != null) {
|
||||||
conf.set(DFS_FEDERATION_NAMESERVICE_ID, nameserviceId);
|
conf.set(DFS_FEDERATION_NAMESERVICE_ID, nameserviceId);
|
||||||
}
|
}
|
||||||
|
@ -1144,6 +1141,7 @@ public class NameNode {
|
||||||
|
|
||||||
DFSUtil.setGenericConf(conf, nameserviceId, namenodeId,
|
DFSUtil.setGenericConf(conf, nameserviceId, namenodeId,
|
||||||
NAMESERVICE_SPECIFIC_KEYS);
|
NAMESERVICE_SPECIFIC_KEYS);
|
||||||
|
}
|
||||||
if (conf.get(DFS_NAMENODE_RPC_ADDRESS_KEY) != null) {
|
if (conf.get(DFS_NAMENODE_RPC_ADDRESS_KEY) != null) {
|
||||||
URI defaultUri = URI.create(HdfsConstants.HDFS_URI_SCHEME + "://"
|
URI defaultUri = URI.create(HdfsConstants.HDFS_URI_SCHEME + "://"
|
||||||
+ conf.get(DFS_NAMENODE_RPC_ADDRESS_KEY));
|
+ conf.get(DFS_NAMENODE_RPC_ADDRESS_KEY));
|
||||||
|
|
|
@ -319,6 +319,25 @@ public class TestDFSUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure that fs.defaultFS is set in the configuration even if neither HA nor
|
||||||
|
* Federation is enabled.
|
||||||
|
*
|
||||||
|
* Regression test for HDFS-3351.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testConfModificationNoFederationOrHa() {
|
||||||
|
final HdfsConfiguration conf = new HdfsConfiguration();
|
||||||
|
String nsId = null;
|
||||||
|
String nnId = null;
|
||||||
|
|
||||||
|
conf.set(DFS_NAMENODE_RPC_ADDRESS_KEY, "localhost:1234");
|
||||||
|
|
||||||
|
assertFalse("hdfs://localhost:1234".equals(conf.get(FS_DEFAULT_NAME_KEY)));
|
||||||
|
NameNode.initializeGenericKeys(conf, nsId, nnId);
|
||||||
|
assertEquals("hdfs://localhost:1234", conf.get(FS_DEFAULT_NAME_KEY));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Regression test for HDFS-2934.
|
* Regression test for HDFS-2934.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue