Search in sources :

Example 6 with MultiProcessCluster

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();
    }
}
Also used : MetricsMasterClient(alluxio.client.metrics.MetricsMasterClient) FileSystem(alluxio.client.file.FileSystem) MultiProcessCluster(alluxio.multi.process.MultiProcessCluster) AlluxioURI(alluxio.AlluxioURI) URI(java.net.URI) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test)

Example 7 with MultiProcessCluster

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();
    }
}
Also used : FileSystem(alluxio.client.file.FileSystem) SleepingUnderFileSystem(alluxio.testutils.underfs.sleeping.SleepingUnderFileSystem) MultiProcessCluster(alluxio.multi.process.MultiProcessCluster) AlluxioURI(alluxio.AlluxioURI) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Aggregations

MultiProcessCluster (alluxio.multi.process.MultiProcessCluster)7 AlluxioURI (alluxio.AlluxioURI)6 Test (org.junit.Test)6 FileSystem (alluxio.client.file.FileSystem)4 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)3 SleepingUnderFileSystem (alluxio.testutils.underfs.sleeping.SleepingUnderFileSystem)2 File (java.io.File)2 URI (java.net.URI)2 MetaMasterClient (alluxio.client.meta.MetaMasterClient)1 RetryHandlingMetaMasterClient (alluxio.client.meta.RetryHandlingMetaMasterClient)1 MetricsMasterClient (alluxio.client.metrics.MetricsMasterClient)1 NoopMaster (alluxio.master.NoopMaster)1 CreateFile (alluxio.master.backcompat.ops.CreateFile)1 PersistFile (alluxio.master.backcompat.ops.PersistFile)1 UfsJournal (alluxio.master.journal.ufs.UfsJournal)1 JCommander (com.beust.jcommander.JCommander)1 Collections (java.util.Collections)1