use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class JournalShutdownIntegrationTest method reproduceAndCheckState.
/**
* Reproduce the journal and check if the state is correct.
*/
private void reproduceAndCheckState(int successFiles) throws Exception {
Assert.assertNotEquals(successFiles, 0);
FileSystemMaster fsMaster = createFsMasterFromJournal();
int actualFiles = fsMaster.listStatus(new AlluxioURI(TEST_FILE_DIR), ListStatusOptions.defaults()).size();
Assert.assertTrue((successFiles == actualFiles) || (successFiles + 1 == actualFiles));
for (int f = 0; f < successFiles; f++) {
Assert.assertTrue(fsMaster.getFileId(new AlluxioURI(TEST_FILE_DIR + f)) != IdUtils.INVALID_FILE_ID);
}
fsMaster.stop();
}
use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class MasterFaultToleranceIntegrationTest method killStandby.
@Test
public void killStandby() throws Exception {
// If standby masters are killed(or node failure), current leader should not be affected and the
// cluster should run properly.
int leaderIndex = mMultiMasterLocalAlluxioCluster.getLeaderIndex();
Assert.assertNotEquals(-1, leaderIndex);
List<Pair<Long, AlluxioURI>> answer = new ArrayList<>();
for (int k = 0; k < 5; k++) {
faultTestDataCreation(new AlluxioURI("/data" + k), answer);
}
faultTestDataCheck(answer);
for (int kills = 0; kills < MASTERS - 1; kills++) {
Assert.assertTrue(mMultiMasterLocalAlluxioCluster.stopStandby());
CommonUtils.sleepMs(Constants.SECOND_MS * 2);
// Leader should not change.
Assert.assertEquals(leaderIndex, mMultiMasterLocalAlluxioCluster.getLeaderIndex());
// Cluster should still work.
faultTestDataCheck(answer);
faultTestDataCreation(new AlluxioURI("/data_kills_" + kills), answer);
}
}
use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class FileSystemMasterClientIntegrationTest method openClose.
@Test
public void openClose() throws AlluxioException, IOException {
FileSystemMasterClient fsMasterClient = FileSystemMasterClient.Factory.create(mLocalAlluxioClusterResource.get().getMaster().getAddress());
AlluxioURI file = new AlluxioURI("/file");
Assert.assertFalse(fsMasterClient.isConnected());
fsMasterClient.connect();
Assert.assertTrue(fsMasterClient.isConnected());
fsMasterClient.createFile(file, CreateFileOptions.defaults());
Assert.assertNotNull(fsMasterClient.getStatus(file));
fsMasterClient.disconnect();
Assert.assertFalse(fsMasterClient.isConnected());
fsMasterClient.connect();
Assert.assertTrue(fsMasterClient.isConnected());
Assert.assertNotNull(fsMasterClient.getStatus(file));
fsMasterClient.close();
}
use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class FileSystemMasterClientIntegrationTest method masterUnavailable.
@Test(timeout = 300000)
public void masterUnavailable() throws Exception {
FileSystem fileSystem = mLocalAlluxioClusterResource.get().getClient();
mLocalAlluxioClusterResource.get().getMaster().stop();
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(3000);
mLocalAlluxioClusterResource.get().getMaster().start();
} catch (InterruptedException e) {
throw Throwables.propagate(e);
}
}
});
thread.start();
fileSystem.listStatus(new AlluxioURI("/"));
thread.join();
}
use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class JournalIntegrationTest method mountEntryCheckpointTest.
/**
* Tests the situation where a checkpoint mount entry is replayed by a standby master.
*
* @throws Exception on error
*/
@Test
public void mountEntryCheckpointTest() throws Exception {
final AlluxioURI mountUri = new AlluxioURI("/local_mnt/");
final AlluxioURI ufsUri = new AlluxioURI(mTestFolder.newFolder("test_ufs").getAbsolutePath());
// Create a mount point, which will journal a mount entry.
mFileSystem.mount(mountUri, ufsUri);
mLocalAlluxioCluster.stopFS();
// Start a leader master, which will create a new checkpoint, with a mount entry.
MasterTestUtils.createLeaderFileSystemMasterFromJournal().stop();
// Start a standby master, which will replay the mount entry from the checkpoint.
final FileSystemMaster fsMaster = MasterTestUtils.createStandbyFileSystemMasterFromJournal();
try {
CommonUtils.waitFor("standby journal checkpoint replay", new Function<Void, Boolean>() {
@Override
public Boolean apply(Void input) {
try {
fsMaster.listStatus(mountUri, ListStatusOptions.defaults());
return true;
} catch (Exception e) {
return false;
}
}
}, WaitForOptions.defaults().setTimeout(60 * Constants.SECOND_MS));
} finally {
fsMaster.stop();
}
}
Aggregations