HDFS-4593. TestSaveNamespace fails on Windows. Contributed by Arpit Agarwal.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1455956 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Suresh Srinivas 2013-03-13 14:28:55 +00:00
parent 38a5a4e98e
commit e4e13618e8
2 changed files with 23 additions and 21 deletions

View File

@ -332,6 +332,8 @@ Trunk (Unreleased)
HDFS-4287. HTTPFS tests fail on Windows. (Chris Nauroth via suresh) HDFS-4287. HTTPFS tests fail on Windows. (Chris Nauroth via suresh)
HDFS-4593. TestSaveNamespace fails on Windows. (Arpit Agarwal via suresh)
Release 2.0.5-beta - UNRELEASED Release 2.0.5-beta - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -41,6 +41,7 @@
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsAction;
import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.fs.permission.PermissionStatus; import org.apache.hadoop.fs.permission.PermissionStatus;
import org.apache.hadoop.hdfs.DFSConfigKeys; import org.apache.hadoop.hdfs.DFSConfigKeys;
@ -219,7 +220,7 @@ private void saveNamespaceWithInjectedFault(Fault fault) throws Exception {
* Verify that a saveNamespace command brings faulty directories * Verify that a saveNamespace command brings faulty directories
* in fs.name.dir and fs.edit.dir back online. * in fs.name.dir and fs.edit.dir back online.
*/ */
@Test @Test (timeout=30000)
public void testReinsertnamedirsInSavenamespace() throws Exception { public void testReinsertnamedirsInSavenamespace() throws Exception {
// create a configuration with the key to restore error // create a configuration with the key to restore error
// directories in fs.name.dir // directories in fs.name.dir
@ -237,10 +238,13 @@ public void testReinsertnamedirsInSavenamespace() throws Exception {
FSImage spyImage = spy(originalImage); FSImage spyImage = spy(originalImage);
fsn.dir.fsImage = spyImage; fsn.dir.fsImage = spyImage;
FileSystem fs = FileSystem.getLocal(conf);
File rootDir = storage.getStorageDir(0).getRoot(); File rootDir = storage.getStorageDir(0).getRoot();
rootDir.setExecutable(false); Path rootPath = new Path(rootDir.getPath(), "current");
rootDir.setWritable(false); final FsPermission permissionNone = new FsPermission((short) 0);
rootDir.setReadable(false); final FsPermission permissionAll = new FsPermission(
FsAction.ALL, FsAction.READ_EXECUTE, FsAction.READ_EXECUTE);
fs.setPermission(rootPath, permissionNone);
try { try {
doAnEdit(fsn, 1); doAnEdit(fsn, 1);
@ -257,9 +261,7 @@ public void testReinsertnamedirsInSavenamespace() throws Exception {
" bad directories.", " bad directories.",
storage.getRemovedStorageDirs().size() == 1); storage.getRemovedStorageDirs().size() == 1);
rootDir.setExecutable(true); fs.setPermission(rootPath, permissionAll);
rootDir.setWritable(true);
rootDir.setReadable(true);
// The next call to savenamespace should try inserting the // The next call to savenamespace should try inserting the
// erroneous directory back to fs.name.dir. This command should // erroneous directory back to fs.name.dir. This command should
@ -290,9 +292,7 @@ public void testReinsertnamedirsInSavenamespace() throws Exception {
LOG.info("Reloaded image is good."); LOG.info("Reloaded image is good.");
} finally { } finally {
if (rootDir.exists()) { if (rootDir.exists()) {
rootDir.setExecutable(true); fs.setPermission(rootPath, permissionAll);
rootDir.setWritable(true);
rootDir.setReadable(true);
} }
if (fsn != null) { if (fsn != null) {
@ -305,27 +305,27 @@ public void testReinsertnamedirsInSavenamespace() throws Exception {
} }
} }
@Test @Test (timeout=30000)
public void testRTEWhileSavingSecondImage() throws Exception { public void testRTEWhileSavingSecondImage() throws Exception {
saveNamespaceWithInjectedFault(Fault.SAVE_SECOND_FSIMAGE_RTE); saveNamespaceWithInjectedFault(Fault.SAVE_SECOND_FSIMAGE_RTE);
} }
@Test @Test (timeout=30000)
public void testIOEWhileSavingSecondImage() throws Exception { public void testIOEWhileSavingSecondImage() throws Exception {
saveNamespaceWithInjectedFault(Fault.SAVE_SECOND_FSIMAGE_IOE); saveNamespaceWithInjectedFault(Fault.SAVE_SECOND_FSIMAGE_IOE);
} }
@Test @Test (timeout=30000)
public void testCrashInAllImageDirs() throws Exception { public void testCrashInAllImageDirs() throws Exception {
saveNamespaceWithInjectedFault(Fault.SAVE_ALL_FSIMAGES); saveNamespaceWithInjectedFault(Fault.SAVE_ALL_FSIMAGES);
} }
@Test @Test (timeout=30000)
public void testCrashWhenWritingVersionFiles() throws Exception { public void testCrashWhenWritingVersionFiles() throws Exception {
saveNamespaceWithInjectedFault(Fault.WRITE_STORAGE_ALL); saveNamespaceWithInjectedFault(Fault.WRITE_STORAGE_ALL);
} }
@Test @Test (timeout=30000)
public void testCrashWhenWritingVersionFileInOneDir() throws Exception { public void testCrashWhenWritingVersionFileInOneDir() throws Exception {
saveNamespaceWithInjectedFault(Fault.WRITE_STORAGE_ONE); saveNamespaceWithInjectedFault(Fault.WRITE_STORAGE_ONE);
} }
@ -337,7 +337,7 @@ public void testCrashWhenWritingVersionFileInOneDir() throws Exception {
* failed checkpoint since it only affected ".ckpt" files, not * failed checkpoint since it only affected ".ckpt" files, not
* valid image files * valid image files
*/ */
@Test @Test (timeout=30000)
public void testFailedSaveNamespace() throws Exception { public void testFailedSaveNamespace() throws Exception {
doTestFailedSaveNamespace(false); doTestFailedSaveNamespace(false);
} }
@ -347,7 +347,7 @@ public void testFailedSaveNamespace() throws Exception {
* the operator restores the directories and calls it again. * the operator restores the directories and calls it again.
* This should leave the NN in a clean state for next start. * This should leave the NN in a clean state for next start.
*/ */
@Test @Test (timeout=30000)
public void testFailedSaveNamespaceWithRecovery() throws Exception { public void testFailedSaveNamespaceWithRecovery() throws Exception {
doTestFailedSaveNamespace(true); doTestFailedSaveNamespace(true);
} }
@ -421,7 +421,7 @@ public void doTestFailedSaveNamespace(boolean restoreStorageAfterFailure)
} }
} }
@Test @Test (timeout=30000)
public void testSaveWhileEditsRolled() throws Exception { public void testSaveWhileEditsRolled() throws Exception {
Configuration conf = getConf(); Configuration conf = getConf();
NameNode.initMetrics(conf, NamenodeRole.NAMENODE); NameNode.initMetrics(conf, NamenodeRole.NAMENODE);
@ -457,7 +457,7 @@ public void testSaveWhileEditsRolled() throws Exception {
} }
} }
@Test @Test (timeout=30000)
public void testTxIdPersistence() throws Exception { public void testTxIdPersistence() throws Exception {
Configuration conf = getConf(); Configuration conf = getConf();
NameNode.initMetrics(conf, NamenodeRole.NAMENODE); NameNode.initMetrics(conf, NamenodeRole.NAMENODE);
@ -580,7 +580,7 @@ public Void call() throws Exception {
* open lease and destination directory exist. * open lease and destination directory exist.
* This test is a regression for HDFS-2827 * This test is a regression for HDFS-2827
*/ */
@Test @Test (timeout=30000)
public void testSaveNamespaceWithRenamedLease() throws Exception { public void testSaveNamespaceWithRenamedLease() throws Exception {
MiniDFSCluster cluster = new MiniDFSCluster.Builder(new Configuration()) MiniDFSCluster cluster = new MiniDFSCluster.Builder(new Configuration())
.numDataNodes(1).build(); .numDataNodes(1).build();
@ -603,7 +603,7 @@ public void testSaveNamespaceWithRenamedLease() throws Exception {
} }
} }
@Test @Test (timeout=30000)
public void testSaveNamespaceWithDanglingLease() throws Exception { public void testSaveNamespaceWithDanglingLease() throws Exception {
MiniDFSCluster cluster = new MiniDFSCluster.Builder(new Configuration()) MiniDFSCluster cluster = new MiniDFSCluster.Builder(new Configuration())
.numDataNodes(1).build(); .numDataNodes(1).build();