HDFS-13058. Fix dfs.namenode.shared.edits.dir in TestJournalNode. Contributed by Bharat Viswanadham.

This commit is contained in:
Arpit Agarwal 2018-02-16 10:29:22 -08:00
parent 8d5ea7470a
commit 4c2119f04e

View File

@ -83,6 +83,7 @@ public void setup() throws Exception {
File editsDir = new File(MiniDFSCluster.getBaseDirectory() + File editsDir = new File(MiniDFSCluster.getBaseDirectory() +
File.separator + "TestJournalNode"); File.separator + "TestJournalNode");
FileUtil.fullyDelete(editsDir); FileUtil.fullyDelete(editsDir);
journalId = "test-journalid-" + GenericTestUtils.uniqueSequenceId();
if (testName.getMethodName().equals("testJournalDirPerNameSpace")) { if (testName.getMethodName().equals("testJournalDirPerNameSpace")) {
setFederationConf(); setFederationConf();
@ -113,33 +114,33 @@ public void setup() throws Exception {
conf.setBoolean(DFSConfigKeys.DFS_JOURNALNODE_ENABLE_SYNC_KEY, conf.setBoolean(DFSConfigKeys.DFS_JOURNALNODE_ENABLE_SYNC_KEY,
false); false);
conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY, conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY,
"qjournal://jn0:9900;jn1:9901"); "qjournal://jn0:9900;jn1:9901/" + journalId);
} else if (testName.getMethodName().equals( } else if (testName.getMethodName().equals(
"testJournalNodeSyncerNotStartWhenSyncEnabledIncorrectURI")) { "testJournalNodeSyncerNotStartWhenSyncEnabledIncorrectURI")) {
conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY, conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY,
"qjournal://journal0\\:9900;journal1:9901"); "qjournal://journal0\\:9900;journal1:9901/" + journalId);
} else if (testName.getMethodName().equals( } else if (testName.getMethodName().equals(
"testJournalNodeSyncerNotStartWhenSyncEnabled")) { "testJournalNodeSyncerNotStartWhenSyncEnabled")) {
conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY, conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY,
"qjournal://jn0:9900;jn1:9901"); "qjournal://jn0:9900;jn1:9901/" + journalId);
} else if (testName.getMethodName().equals( } else if (testName.getMethodName().equals(
"testJournalNodeSyncwithFederationTypeConfigWithNameServiceId")) { "testJournalNodeSyncwithFederationTypeConfigWithNameServiceId")) {
conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY +".ns1", conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY +".ns1",
"qjournal://journalnode0:9900;journalnode0:9901"); "qjournal://journalnode0:9900;journalnode0:9901/" + journalId);
} else if (testName.getMethodName().equals( } else if (testName.getMethodName().equals(
"testJournalNodeSyncwithFederationTypeConfigWithNamenodeId")) { "testJournalNodeSyncwithFederationTypeConfigWithNamenodeId")) {
conf.set(DFSConfigKeys.DFS_HA_NAMENODES_KEY_PREFIX + ".ns1", "nn1,nn2"); conf.set(DFSConfigKeys.DFS_HA_NAMENODES_KEY_PREFIX + ".ns1", "nn1,nn2");
conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY +".ns1" +".nn1", conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY +".ns1" +".nn1",
"qjournal://journalnode0:9900;journalnode1:9901"); "qjournal://journalnode0:9900;journalnode1:9901/" +journalId);
conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY +".ns1" +".nn2", conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY +".ns1" +".nn2",
"qjournal://journalnode0:9900;journalnode1:9901"); "qjournal://journalnode0:9900;journalnode1:9901/" +journalId);
} else if (testName.getMethodName().equals( } else if (testName.getMethodName().equals(
"testJournalNodeSyncwithFederationTypeIncorrectConfigWithNamenodeId")) { "testJournalNodeSyncwithFederationTypeIncorrectConfigWithNamenodeId")) {
conf.set(DFSConfigKeys.DFS_HA_NAMENODES_KEY_PREFIX + ".ns1", "nn1,nn2"); conf.set(DFSConfigKeys.DFS_HA_NAMENODES_KEY_PREFIX + ".ns1", "nn1,nn2");
conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY +".ns1" +".nn1", conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY +".ns1" +".nn1",
"qjournal://journalnode0:9900;journalnode1:9901"); "qjournal://journalnode0:9900;journalnode1:9901/" + journalId);
conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY +".ns1" +".nn2", conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY +".ns1" +".nn2",
"qjournal://journalnode0:9902;journalnode1:9903"); "qjournal://journalnode0:9902;journalnode1:9903/" + journalId);
} }
jn = new JournalNode(); jn = new JournalNode();
jn.setConf(conf); jn.setConf(conf);
@ -161,7 +162,6 @@ public void setup() throws Exception {
journal.format(fakeNameSpaceInfo); journal.format(fakeNameSpaceInfo);
} }
} else { } else {
journalId = "test-journalid-" + GenericTestUtils.uniqueSequenceId();
journal = jn.getOrCreateJournal(journalId); journal = jn.getOrCreateJournal(journalId);
journal.format(FAKE_NSINFO); journal.format(FAKE_NSINFO);
} }
@ -176,16 +176,16 @@ private void setFederationConf() {
//ns1 //ns1
conf.set(DFSConfigKeys.DFS_HA_NAMENODES_KEY_PREFIX + ".ns1", "nn1,nn2"); conf.set(DFSConfigKeys.DFS_HA_NAMENODES_KEY_PREFIX + ".ns1", "nn1,nn2");
conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY +".ns1" +".nn1", conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY +".ns1" +".nn1",
"qjournal://journalnode0:9900;journalnode1:9901/ns1"); "qjournal://journalnode0:9900;journalnode1:9901/test-journalid-ns1");
conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY +".ns1" +".nn2", conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY +".ns1" +".nn2",
"qjournal://journalnode0:9900;journalnode1:9901/ns2"); "qjournal://journalnode0:9900;journalnode1:9901/test-journalid-ns1");
//ns2 //ns2
conf.set(DFSConfigKeys.DFS_HA_NAMENODES_KEY_PREFIX + ".ns2", "nn3,nn4"); conf.set(DFSConfigKeys.DFS_HA_NAMENODES_KEY_PREFIX + ".ns2", "nn3,nn4");
conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY +".ns2" +".nn3", conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY +".ns2" +".nn3",
"qjournal://journalnode0:9900;journalnode1:9901/ns2"); "qjournal://journalnode0:9900;journalnode1:9901/test-journalid-ns2");
conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY +".ns2" +".nn4", conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY +".ns2" +".nn4",
"qjournal://journalnode0:9900;journalnode1:9901/ns2"); "qjournal://journalnode0:9900;journalnode1:9901/test-journalid-ns2");
} }
@After @After