use of alluxio.multi.process.MultiProcessCluster in project alluxio by Alluxio.
the class MultiProcessCheckpointTest method test.
@Test
public void test() throws Exception {
MultiProcessCluster cluster = MultiProcessCluster.newBuilder(PortCoordination.CHECKPOINT).setClusterName("CheckpointTest").addProperty(PropertyKey.MASTER_JOURNAL_TYPE, JournalType.UFS.toString()).addProperty(PropertyKey.ZOOKEEPER_SESSION_TIMEOUT, "2sec").addProperty(PropertyKey.ZOOKEEPER_CONNECTION_TIMEOUT, "1sec").addProperty(PropertyKey.MASTER_METASTORE, "ROCKS").addProperty(PropertyKey.MASTER_JOURNAL_CHECKPOINT_PERIOD_ENTRIES, "100").addProperty(PropertyKey.MASTER_JOURNAL_LOG_SIZE_BYTES_MAX, "500").addProperty(PropertyKey.MASTER_JOURNAL_TAILER_SHUTDOWN_QUIET_WAIT_TIME_MS, "500").setNumMasters(2).setNumWorkers(0).build();
try {
cluster.start();
cluster.waitForAllNodesRegistered(20 * Constants.SECOND_MS);
String journal = cluster.getJournalDir();
FileSystem fs = cluster.getFileSystemClient();
int numFiles = 100;
for (int i = 0; i < numFiles; i++) {
fs.createFile(new AlluxioURI("/file" + i)).close();
}
MetricsMasterClient metricsClient = cluster.getMetricsMasterClient();
assertEquals(numFiles + 1, (long) metricsClient.getMetrics().get(MetricKey.MASTER_TOTAL_PATHS.getName()).getDoubleValue());
IntegrationTestUtils.waitForUfsJournalCheckpoint(Constants.FILE_SYSTEM_MASTER_NAME, new URI(journal));
cluster.stopMasters();
cluster.startMasters();
cluster.waitForAllNodesRegistered(60 * Constants.SECOND_MS);
fs = cluster.getFileSystemClient();
assertEquals(numFiles, fs.listStatus(new AlluxioURI("/")).size());
assertEquals(numFiles + 1, (long) metricsClient.getMetrics().get(MetricKey.MASTER_TOTAL_PATHS.getName()).getDoubleValue());
cluster.notifySuccess();
} finally {
cluster.destroy();
}
}
use of alluxio.multi.process.MultiProcessCluster in project alluxio by Alluxio.
the class JournalShutdownIntegrationTest method multiMasterJournalStopIntegration.
/*
* We use the external cluster for this test due to flakiness issues when running in a single JVM.
*/
@Test
public void multiMasterJournalStopIntegration() throws Exception {
MultiProcessCluster cluster = MultiProcessCluster.newBuilder(PortCoordination.JOURNAL_STOP_MULTI_MASTER).setClusterName("multiMasterJournalStopIntegration").setNumWorkers(0).setNumMasters(TEST_NUM_MASTERS).addProperty(PropertyKey.ZOOKEEPER_SESSION_TIMEOUT, "6s").build();
try {
cluster.start();
FileSystem fs = cluster.getFileSystemClient();
runCreateFileThread(fs);
for (int i = 0; i < TEST_NUM_MASTERS; i++) {
cluster.waitForAndKillPrimaryMaster(30 * Constants.SECOND_MS);
}
awaitClientTermination();
cluster.startMaster(0);
int actualFiles = fs.listStatus(new AlluxioURI(TEST_FILE_DIR)).size();
int successFiles = mCreateFileThread.getSuccessNum();
assertTrue(String.format("successFiles: %s, actualFiles: %s", successFiles, actualFiles), (successFiles == actualFiles) || (successFiles + 1 == actualFiles));
cluster.notifySuccess();
} finally {
cluster.destroy();
}
}
Aggregations