use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class JournalIntegrationTest method failDuringCheckpointRename.
@Test
public void failDuringCheckpointRename() throws Exception {
AlluxioURI file = new AlluxioURI("/file");
mFileSystem.createFile(file).close();
// Restart the master once so that it creates a checkpoint file.
mLocalAlluxioCluster.stopFS();
createFsMasterFromJournal();
AlluxioURI journal = new AlluxioURI(Configuration.get(PropertyKey.MASTER_JOURNAL_FOLDER));
try (UnderFileSystemSpy ufsSpy = new UnderFileSystemSpy(journal)) {
doThrow(new RuntimeException("Failed to rename")).when(ufsSpy.get()).renameFile(Mockito.contains("FileSystemMaster/checkpoint.data.tmp"), anyString());
try {
// Restart the master again, but with renaming the checkpoint file failing.
mLocalAlluxioCluster.stopFS();
createFsMasterFromJournal();
Assert.fail("Should have failed during rename");
} catch (RuntimeException e) {
Assert.assertEquals("Failed to rename", e.getMessage());
}
}
// We shouldn't lose track of the fact that the file is loaded into memory.
FileSystemMaster fsMaster = createFsMasterFromJournal();
Assert.assertTrue(fsMaster.getInMemoryFiles().contains(file));
}
use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class JournalIntegrationTest method rename.
/**
* Tests file and directory creation, and rename.
*/
@Test
public void rename() throws Exception {
for (int i = 0; i < 10; i++) {
mFileSystem.createDirectory(new AlluxioURI("/i" + i));
for (int j = 0; j < 10; j++) {
CreateFileOptions option = CreateFileOptions.defaults().setBlockSizeBytes((i + j + 1) * 64);
AlluxioURI path = new AlluxioURI("/i" + i + "/j" + j);
mFileSystem.createFile(path, option).close();
mFileSystem.rename(path, new AlluxioURI("/i" + i + "/jj" + j));
}
mFileSystem.rename(new AlluxioURI("/i" + i), new AlluxioURI("/ii" + i));
}
mLocalAlluxioCluster.stopFS();
renameTestUtil();
deleteFsMasterJournalLogs();
renameTestUtil();
}
use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class JournalIntegrationTest method failDuringCheckpointDelete.
@Test
public void failDuringCheckpointDelete() throws Exception {
AlluxioURI file = new AlluxioURI("/file");
mFileSystem.createFile(file).close();
// Restart the master once so that it creates a checkpoint file.
mLocalAlluxioCluster.stopFS();
createFsMasterFromJournal();
AlluxioURI journal = new AlluxioURI(Configuration.get(PropertyKey.MASTER_JOURNAL_FOLDER));
try (UnderFileSystemSpy ufsSpy = new UnderFileSystemSpy(journal)) {
doThrow(new RuntimeException("Failed to delete")).when(ufsSpy.get()).deleteFile(Mockito.contains("FileSystemMaster/checkpoint.data"));
try {
// Restart the master again, but with deleting the checkpoint file failing.
mLocalAlluxioCluster.stopFS();
createFsMasterFromJournal();
Assert.fail("Should have failed during delete");
} catch (RuntimeException e) {
Assert.assertEquals("Failed to delete", e.getMessage());
}
}
// We shouldn't lose track of the fact that the file is loaded into memory.
FileSystemMaster fsMaster = createFsMasterFromJournal();
Assert.assertTrue(fsMaster.getInMemoryFiles().contains(file));
}
use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class JournalIntegrationTest method manyFileTestUtil.
private void manyFileTestUtil() throws Exception {
FileSystemMaster fsMaster = createFsMasterFromJournal();
long rootId = fsMaster.getFileId(mRootUri);
Assert.assertTrue(rootId != IdUtils.INVALID_FILE_ID);
Assert.assertEquals(10, fsMaster.listStatus(mRootUri, ListStatusOptions.defaults().setLoadMetadataType(LoadMetadataType.Never)).size());
for (int k = 0; k < 10; k++) {
Assert.assertTrue(fsMaster.getFileId(new AlluxioURI("/a" + k)) != IdUtils.INVALID_FILE_ID);
}
fsMaster.stop();
}
use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class JournalIntegrationTest method multiEditLog.
/**
* Tests reading multiple edit logs.
*/
@Test
public void multiEditLog() throws Exception {
for (int i = 0; i < 124; i++) {
CreateFileOptions op = CreateFileOptions.defaults().setBlockSizeBytes((i + 10) / 10 * 64);
mFileSystem.createFile(new AlluxioURI("/a" + i), op).close();
}
mLocalAlluxioCluster.stopFS();
multiEditLogTestUtil();
deleteFsMasterJournalLogs();
multiEditLogTestUtil();
}
Aggregations