HDFS-4625. Make TestNNWithQJM#testNewNamenodeTakesOverWriter work on Windows. Contributed by Ivan Mitic.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1464780 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
681312d9c4
commit
999ce497f0
@ -346,6 +346,9 @@ Trunk (Unreleased)
|
|||||||
|
|
||||||
HDFS-4604. TestJournalNode fails on Windows. (Ivan Mitic via suresh)
|
HDFS-4604. TestJournalNode fails on Windows. (Ivan Mitic via suresh)
|
||||||
|
|
||||||
|
HDFS-4625. Make TestNNWithQJM#testNewNamenodeTakesOverWriter work on
|
||||||
|
Windows. (Ivan Mitic via suresh)
|
||||||
|
|
||||||
Release 2.0.5-beta - UNRELEASED
|
Release 2.0.5-beta - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -98,9 +98,6 @@ public void testLogAndRestart() throws IOException {
|
|||||||
|
|
||||||
@Test (timeout = 30000)
|
@Test (timeout = 30000)
|
||||||
public void testNewNamenodeTakesOverWriter() throws Exception {
|
public void testNewNamenodeTakesOverWriter() throws Exception {
|
||||||
// Skip the test on Windows. See HDFS-4584.
|
|
||||||
assumeTrue(!Path.WINDOWS);
|
|
||||||
|
|
||||||
File nn1Dir = new File(
|
File nn1Dir = new File(
|
||||||
MiniDFSCluster.getBaseDirectory() + "/TestNNWithQJM/image-nn1");
|
MiniDFSCluster.getBaseDirectory() + "/TestNNWithQJM/image-nn1");
|
||||||
File nn2Dir = new File(
|
File nn2Dir = new File(
|
||||||
@ -110,23 +107,37 @@ public void testNewNamenodeTakesOverWriter() throws Exception {
|
|||||||
nn1Dir.getAbsolutePath());
|
nn1Dir.getAbsolutePath());
|
||||||
conf.set(DFSConfigKeys.DFS_NAMENODE_EDITS_DIR_KEY,
|
conf.set(DFSConfigKeys.DFS_NAMENODE_EDITS_DIR_KEY,
|
||||||
mjc.getQuorumJournalURI("myjournal").toString());
|
mjc.getQuorumJournalURI("myjournal").toString());
|
||||||
|
|
||||||
|
// Start the cluster once to generate the dfs dirs
|
||||||
MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf)
|
MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf)
|
||||||
.numDataNodes(0)
|
.numDataNodes(0)
|
||||||
.manageNameDfsDirs(false)
|
.manageNameDfsDirs(false)
|
||||||
.checkExitOnShutdown(false)
|
.checkExitOnShutdown(false)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
// Shutdown the cluster before making a copy of the namenode dir
|
||||||
|
// to release all file locks, otherwise, the copy will fail on
|
||||||
|
// some platforms.
|
||||||
|
cluster.shutdown();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
cluster.getFileSystem().mkdirs(TEST_PATH);
|
|
||||||
|
|
||||||
// Start a second NN pointed to the same quorum.
|
// Start a second NN pointed to the same quorum.
|
||||||
// We need to copy the image dir from the first NN -- or else
|
// We need to copy the image dir from the first NN -- or else
|
||||||
// the new NN will just be rejected because of Namespace mismatch.
|
// the new NN will just be rejected because of Namespace mismatch.
|
||||||
FileUtil.fullyDelete(nn2Dir);
|
FileUtil.fullyDelete(nn2Dir);
|
||||||
FileUtil.copy(nn1Dir, FileSystem.getLocal(conf).getRaw(),
|
FileUtil.copy(nn1Dir, FileSystem.getLocal(conf).getRaw(),
|
||||||
new Path(nn2Dir.getAbsolutePath()), false, conf);
|
new Path(nn2Dir.getAbsolutePath()), false, conf);
|
||||||
|
|
||||||
|
// Start the cluster again
|
||||||
|
cluster = new MiniDFSCluster.Builder(conf)
|
||||||
|
.numDataNodes(0)
|
||||||
|
.format(false)
|
||||||
|
.manageNameDfsDirs(false)
|
||||||
|
.checkExitOnShutdown(false)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
cluster.getFileSystem().mkdirs(TEST_PATH);
|
||||||
|
|
||||||
Configuration conf2 = new Configuration();
|
Configuration conf2 = new Configuration();
|
||||||
conf2.set(DFSConfigKeys.DFS_NAMENODE_NAME_DIR_KEY,
|
conf2.set(DFSConfigKeys.DFS_NAMENODE_NAME_DIR_KEY,
|
||||||
nn2Dir.getAbsolutePath());
|
nn2Dir.getAbsolutePath());
|
||||||
|
Loading…
Reference in New Issue
Block a user