|
@@ -21,6 +21,7 @@ import static org.apache.hadoop.hdfs.server.namenode.NNStorage.getFinalizedEdits
|
|
import static org.apache.hadoop.hdfs.server.namenode.NNStorage.getImageFileName;
|
|
import static org.apache.hadoop.hdfs.server.namenode.NNStorage.getImageFileName;
|
|
import static org.apache.hadoop.hdfs.server.namenode.NNStorage.getInProgressEditsFileName;
|
|
import static org.apache.hadoop.hdfs.server.namenode.NNStorage.getInProgressEditsFileName;
|
|
import static org.apache.hadoop.test.GenericTestUtils.assertGlobEquals;
|
|
import static org.apache.hadoop.test.GenericTestUtils.assertGlobEquals;
|
|
|
|
+import static org.junit.Assert.assertEquals;
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
@@ -59,7 +60,7 @@ public class TestNNStorageRetentionFunctional {
|
|
*/
|
|
*/
|
|
@Test
|
|
@Test
|
|
public void testPurgingWithNameEditsDirAfterFailure()
|
|
public void testPurgingWithNameEditsDirAfterFailure()
|
|
- throws IOException {
|
|
|
|
|
|
+ throws Exception {
|
|
MiniDFSCluster cluster = null;
|
|
MiniDFSCluster cluster = null;
|
|
Configuration conf = new HdfsConfiguration();
|
|
Configuration conf = new HdfsConfiguration();
|
|
conf.setLong(DFSConfigKeys.DFS_NAMENODE_NUM_EXTRA_EDITS_RETAINED_KEY, 0);
|
|
conf.setLong(DFSConfigKeys.DFS_NAMENODE_NUM_EXTRA_EDITS_RETAINED_KEY, 0);
|
|
@@ -107,10 +108,10 @@ public class TestNNStorageRetentionFunctional {
|
|
getInProgressEditsFileName(5));
|
|
getInProgressEditsFileName(5));
|
|
|
|
|
|
LOG.info("Failing first storage dir by chmodding it");
|
|
LOG.info("Failing first storage dir by chmodding it");
|
|
- FileUtil.setExecutable(sd0, false);
|
|
|
|
|
|
+ assertEquals(0, FileUtil.chmod(cd0.getAbsolutePath(), "000"));
|
|
doSaveNamespace(nn);
|
|
doSaveNamespace(nn);
|
|
LOG.info("Restoring accessibility of first storage dir");
|
|
LOG.info("Restoring accessibility of first storage dir");
|
|
- FileUtil.setExecutable(sd0, true);
|
|
|
|
|
|
+ assertEquals(0, FileUtil.chmod(cd0.getAbsolutePath(), "755"));
|
|
|
|
|
|
LOG.info("nothing should have been purged in first storage dir");
|
|
LOG.info("nothing should have been purged in first storage dir");
|
|
assertGlobEquals(cd0, "fsimage_\\d*",
|
|
assertGlobEquals(cd0, "fsimage_\\d*",
|
|
@@ -139,7 +140,7 @@ public class TestNNStorageRetentionFunctional {
|
|
assertGlobEquals(cd0, "edits_.*",
|
|
assertGlobEquals(cd0, "edits_.*",
|
|
getInProgressEditsFileName(9));
|
|
getInProgressEditsFileName(9));
|
|
} finally {
|
|
} finally {
|
|
- FileUtil.setExecutable(sd0, true);
|
|
|
|
|
|
+ FileUtil.chmod(cd0.getAbsolutePath(), "755");
|
|
|
|
|
|
LOG.info("Shutting down...");
|
|
LOG.info("Shutting down...");
|
|
if (cluster != null) {
|
|
if (cluster != null) {
|