Search in sources :

Example 1 with MultiMasterLocalAlluxioCluster

use of alluxio.master.MultiMasterLocalAlluxioCluster in project alluxio by Alluxio.

the class JobServiceFaultToleranceShellTest method before.

@Before
public void before() throws Exception {
    mLocalAlluxioCluster = new MultiMasterLocalAlluxioCluster(2);
    mLocalAlluxioCluster.initConfiguration(IntegrationTestUtils.getTestName(getClass().getSimpleName(), mTestName.getMethodName()));
    mLocalAlluxioCluster.start();
    mLocalAlluxioJobCluster = new LocalAlluxioJobCluster();
    mLocalAlluxioJobCluster.start();
    mOutput = new ByteArrayOutputStream();
    System.setOut(new PrintStream(mOutput));
}
Also used : PrintStream(java.io.PrintStream) LocalAlluxioJobCluster(alluxio.master.LocalAlluxioJobCluster) MultiMasterLocalAlluxioCluster(alluxio.master.MultiMasterLocalAlluxioCluster) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Before(org.junit.Before)

Example 2 with MultiMasterLocalAlluxioCluster

use of alluxio.master.MultiMasterLocalAlluxioCluster in project alluxio by Alluxio.

the class MasterFaultToleranceIntegrationTest method before.

@Before
public final void before() throws Exception {
    // TODO(gpang): Implement multi-master cluster as a resource.
    mMultiMasterLocalAlluxioCluster = new MultiMasterLocalAlluxioCluster(MASTERS);
    mMultiMasterLocalAlluxioCluster.initConfiguration(IntegrationTestUtils.getTestName(getClass().getSimpleName(), mTestName.getMethodName()));
    ServerConfiguration.set(PropertyKey.WORKER_RAMDISK_SIZE, WORKER_CAPACITY_BYTES);
    ServerConfiguration.set(PropertyKey.USER_BLOCK_SIZE_BYTES_DEFAULT, BLOCK_SIZE);
    ServerConfiguration.set(PropertyKey.MASTER_JOURNAL_TAILER_SHUTDOWN_QUIET_WAIT_TIME_MS, 100);
    ServerConfiguration.set(PropertyKey.MASTER_JOURNAL_CHECKPOINT_PERIOD_ENTRIES, 2);
    ServerConfiguration.set(PropertyKey.MASTER_JOURNAL_LOG_SIZE_BYTES_MAX, 32);
    mMultiMasterLocalAlluxioCluster.start();
    mFileSystem = mMultiMasterLocalAlluxioCluster.getClient();
}
Also used : MultiMasterLocalAlluxioCluster(alluxio.master.MultiMasterLocalAlluxioCluster) Before(org.junit.Before)

Example 3 with MultiMasterLocalAlluxioCluster

use of alluxio.master.MultiMasterLocalAlluxioCluster in project alluxio by Alluxio.

the class JournalShutdownIntegrationTest method multiMasterMountUnmountJournal.

@Test
public void multiMasterMountUnmountJournal() throws Exception {
    MultiMasterLocalAlluxioCluster cluster = null;
    UnderFileSystemFactory factory = null;
    try {
        cluster = new MultiMasterLocalAlluxioCluster(TEST_NUM_MASTERS);
        cluster.initConfiguration(IntegrationTestUtils.getTestName(getClass().getSimpleName(), mTestName.getMethodName()));
        cluster.start();
        cluster.stopLeader();
        factory = mountUnmount(cluster.getClient());
        // Kill the leader one by one.
        for (int kills = 0; kills < TEST_NUM_MASTERS; kills++) {
            cluster.waitForNewMaster(120 * Constants.SECOND_MS);
            assertTrue(cluster.stopLeader());
        }
    } finally {
        // Shutdown the cluster
        if (cluster != null) {
            cluster.stopFS();
        }
    }
    CommonUtils.sleepMs(TEST_TIME_MS);
    awaitClientTermination();
    // Fail the creation of UFS
    doThrow(new RuntimeException()).when(factory).create(anyString(), any(UnderFileSystemConfiguration.class));
    createFsMasterFromJournal().close();
}
Also used : UnderFileSystemConfiguration(alluxio.underfs.UnderFileSystemConfiguration) MultiMasterLocalAlluxioCluster(alluxio.master.MultiMasterLocalAlluxioCluster) UnderFileSystemFactory(alluxio.underfs.UnderFileSystemFactory) SleepingUnderFileSystemFactory(alluxio.testutils.underfs.sleeping.SleepingUnderFileSystemFactory) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 4 with MultiMasterLocalAlluxioCluster

use of alluxio.master.MultiMasterLocalAlluxioCluster in project alluxio by Alluxio.

the class MasterFaultToleranceIntegrationTest method failoverWorkerRegister.

@Test
public void failoverWorkerRegister() throws Exception {
    // Stop the default cluster.
    after();
    MultiMasterLocalAlluxioCluster cluster = null;
    try {
        // Create a new cluster, with no workers initially
        cluster = new MultiMasterLocalAlluxioCluster(2, 0);
        cluster.initConfiguration(IntegrationTestUtils.getTestName(getClass().getSimpleName(), mTestName.getMethodName()));
        cluster.start();
        // Get the first block master
        BlockMaster blockMaster1 = cluster.getLocalAlluxioMaster().getMasterProcess().getMaster(BlockMaster.class);
        // Register worker 1
        long workerId1a = blockMaster1.getWorkerId(new alluxio.wire.WorkerNetAddress().setHost("host1"));
        blockMaster1.workerRegister(workerId1a, Collections.EMPTY_LIST, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Collections.EMPTY_MAP, RegisterWorkerPOptions.getDefaultInstance());
        // Register worker 2
        long workerId2a = blockMaster1.getWorkerId(new alluxio.wire.WorkerNetAddress().setHost("host2"));
        blockMaster1.workerRegister(workerId2a, Collections.EMPTY_LIST, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Collections.EMPTY_MAP, RegisterWorkerPOptions.getDefaultInstance());
        assertEquals(2, blockMaster1.getWorkerCount());
        // Worker heartbeats should return "Nothing"
        assertEquals(CommandType.Nothing, blockMaster1.workerHeartbeat(workerId1a, null, Collections.EMPTY_MAP, Collections.EMPTY_LIST, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Lists.newArrayList()).getCommandType());
        assertEquals(CommandType.Nothing, blockMaster1.workerHeartbeat(workerId2a, null, Collections.EMPTY_MAP, Collections.EMPTY_LIST, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Lists.newArrayList()).getCommandType());
        assertTrue(cluster.stopLeader());
        cluster.waitForNewMaster(CLUSTER_WAIT_TIMEOUT_MS);
        // Get the new block master, after the failover
        BlockMaster blockMaster2 = cluster.getLocalAlluxioMaster().getMasterProcess().getMaster(BlockMaster.class);
        // Worker 2 tries to heartbeat (with original id), and should get "Register" in response.
        assertEquals(CommandType.Register, blockMaster2.workerHeartbeat(workerId2a, null, Collections.EMPTY_MAP, Collections.EMPTY_LIST, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Lists.newArrayList()).getCommandType());
        // Worker 2 re-registers (and gets a new worker id)
        long workerId2b = blockMaster2.getWorkerId(new alluxio.wire.WorkerNetAddress().setHost("host2"));
        blockMaster2.workerRegister(workerId2b, Collections.EMPTY_LIST, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Collections.EMPTY_MAP, RegisterWorkerPOptions.getDefaultInstance());
        // Worker 1 tries to heartbeat (with original id), and should get "Register" in response.
        assertEquals(CommandType.Register, blockMaster2.workerHeartbeat(workerId1a, null, Collections.EMPTY_MAP, Collections.EMPTY_LIST, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Lists.newArrayList()).getCommandType());
        // Worker 1 re-registers (and gets a new worker id)
        long workerId1b = blockMaster2.getWorkerId(new alluxio.wire.WorkerNetAddress().setHost("host1"));
        blockMaster2.workerRegister(workerId1b, Collections.EMPTY_LIST, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Collections.EMPTY_MAP, RegisterWorkerPOptions.getDefaultInstance());
    } finally {
        if (cluster != null) {
            cluster.stop();
        }
    }
    // Start the default cluster.
    before();
}
Also used : BlockMaster(alluxio.master.block.BlockMaster) MultiMasterLocalAlluxioCluster(alluxio.master.MultiMasterLocalAlluxioCluster) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 5 with MultiMasterLocalAlluxioCluster

use of alluxio.master.MultiMasterLocalAlluxioCluster in project alluxio by Alluxio.

the class MultiMasterJournalTest method before.

@Before
public void before() throws Exception {
    mCluster = new MultiMasterLocalAlluxioCluster(2, 0);
    mCluster.initConfiguration(IntegrationTestUtils.getTestName(getClass().getSimpleName(), mTestName.getMethodName()));
    ServerConfiguration.set(PropertyKey.MASTER_JOURNAL_CHECKPOINT_PERIOD_ENTRIES, 5);
    ServerConfiguration.set(PropertyKey.MASTER_JOURNAL_LOG_SIZE_BYTES_MAX, 100);
    mCluster.start();
}
Also used : MultiMasterLocalAlluxioCluster(alluxio.master.MultiMasterLocalAlluxioCluster) Before(org.junit.Before)

Aggregations

MultiMasterLocalAlluxioCluster (alluxio.master.MultiMasterLocalAlluxioCluster)7 Before (org.junit.Before)5 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)2 Test (org.junit.Test)2 LocalAlluxioJobCluster (alluxio.master.LocalAlluxioJobCluster)1 BlockMaster (alluxio.master.block.BlockMaster)1 SleepingUnderFileSystemFactory (alluxio.testutils.underfs.sleeping.SleepingUnderFileSystemFactory)1 UnderFileSystemConfiguration (alluxio.underfs.UnderFileSystemConfiguration)1 UnderFileSystemFactory (alluxio.underfs.UnderFileSystemFactory)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintStream (java.io.PrintStream)1