Search in sources :

Example 11 with MasterNetAddress

use of alluxio.multi.process.MasterNetAddress in project alluxio by Alluxio.

the class EmbeddedJournalIntegrationTestTransferLeadership method transferToSelfThenToOther.

@Test
public void transferToSelfThenToOther() throws Exception {
    mCluster = MultiProcessCluster.newBuilder(PortCoordination.EMBEDDED_JOURNAL_UNAVAILABLE_MASTER).setClusterName("EmbeddedJournalTransferLeadership_transferLeadershipToUnavailableMaster").setNumMasters(NUM_MASTERS).setNumWorkers(NUM_WORKERS).addProperty(PropertyKey.MASTER_JOURNAL_TYPE, JournalType.EMBEDDED.toString()).addProperty(PropertyKey.MASTER_JOURNAL_FLUSH_TIMEOUT_MS, "5min").addProperty(PropertyKey.MASTER_EMBEDDED_JOURNAL_MIN_ELECTION_TIMEOUT, "750ms").addProperty(PropertyKey.MASTER_EMBEDDED_JOURNAL_MAX_ELECTION_TIMEOUT, "1500ms").build();
    mCluster.start();
    int leaderIdx = mCluster.getPrimaryMasterIndex(MASTER_INDEX_WAIT_TIME);
    MasterNetAddress leaderAddr = mCluster.getMasterAddresses().get(leaderIdx);
    String transferId = transferAndWait(leaderAddr);
    GetTransferLeaderMessagePResponse transferLeaderMessage = mCluster.getJournalMasterClientForMaster().getTransferLeaderMessage(transferId);
    Assert.assertFalse(transferLeaderMessage.getTransMsg().getMsg().isEmpty());
    int newLeaderIdx = (leaderIdx + 1) % NUM_MASTERS;
    MasterNetAddress newLeaderAddr = mCluster.getMasterAddresses().get(newLeaderIdx);
    transferAndWait(newLeaderAddr);
    mCluster.notifySuccess();
}
Also used : MasterNetAddress(alluxio.multi.process.MasterNetAddress) GetTransferLeaderMessagePResponse(alluxio.grpc.GetTransferLeaderMessagePResponse) Test(org.junit.Test)

Example 12 with MasterNetAddress

use of alluxio.multi.process.MasterNetAddress in project alluxio by Alluxio.

the class EmbeddedJournalIntegrationTestTransferLeadership method repeatedTransferLeadership.

@Test
public void repeatedTransferLeadership() throws Exception {
    mCluster = MultiProcessCluster.newBuilder(PortCoordination.EMBEDDED_JOURNAL_REPEAT_TRANSFER_LEADER).setClusterName("EmbeddedJournalTransferLeadership_repeatedTransferLeadership").setNumMasters(NUM_MASTERS).setNumWorkers(NUM_WORKERS).addProperty(PropertyKey.MASTER_JOURNAL_TYPE, JournalType.EMBEDDED.toString()).addProperty(PropertyKey.MASTER_JOURNAL_FLUSH_TIMEOUT_MS, "5min").addProperty(PropertyKey.MASTER_EMBEDDED_JOURNAL_MIN_ELECTION_TIMEOUT, "750ms").addProperty(PropertyKey.MASTER_EMBEDDED_JOURNAL_MAX_ELECTION_TIMEOUT, "1500ms").build();
    mCluster.start();
    for (int i = 0; i < NUM_MASTERS; i++) {
        int newLeaderIdx = (mCluster.getPrimaryMasterIndex(MASTER_INDEX_WAIT_TIME) + 1) % NUM_MASTERS;
        // `getPrimaryMasterIndex` uses the same `mMasterAddresses` variable as getMasterAddresses
        // we can therefore access to the new leader's address this way
        MasterNetAddress newLeaderAddr = mCluster.getMasterAddresses().get(newLeaderIdx);
        transferAndWait(newLeaderAddr);
    }
    mCluster.notifySuccess();
}
Also used : MasterNetAddress(alluxio.multi.process.MasterNetAddress) Test(org.junit.Test)

Example 13 with MasterNetAddress

use of alluxio.multi.process.MasterNetAddress in project alluxio by Alluxio.

the class EmbeddedJournalIntegrationTestTransferLeadership method transferLeadership.

@Test
public void transferLeadership() throws Exception {
    mCluster = MultiProcessCluster.newBuilder(PortCoordination.EMBEDDED_JOURNAL_TRANSFER_LEADER).setClusterName("EmbeddedJournalTransferLeadership_transferLeadership").setNumMasters(NUM_MASTERS).setNumWorkers(NUM_WORKERS).addProperty(PropertyKey.MASTER_JOURNAL_TYPE, JournalType.EMBEDDED.toString()).addProperty(PropertyKey.MASTER_JOURNAL_FLUSH_TIMEOUT_MS, "5min").addProperty(PropertyKey.MASTER_EMBEDDED_JOURNAL_MIN_ELECTION_TIMEOUT, "750ms").addProperty(PropertyKey.MASTER_EMBEDDED_JOURNAL_MAX_ELECTION_TIMEOUT, "1500ms").build();
    mCluster.start();
    int newLeaderIdx = (mCluster.getPrimaryMasterIndex(MASTER_INDEX_WAIT_TIME) + 1) % NUM_MASTERS;
    // `getPrimaryMasterIndex` uses the same `mMasterAddresses` variable as getMasterAddresses
    // we can therefore access to the new leader's address this way
    MasterNetAddress newLeaderAddr = mCluster.getMasterAddresses().get(newLeaderIdx);
    transferAndWait(newLeaderAddr);
    mCluster.notifySuccess();
}
Also used : MasterNetAddress(alluxio.multi.process.MasterNetAddress) Test(org.junit.Test)

Aggregations

MasterNetAddress (alluxio.multi.process.MasterNetAddress)13 Test (org.junit.Test)11 NetAddress (alluxio.grpc.NetAddress)5 FileSystemAdminShell (alluxio.cli.fsadmin.FileSystemAdminShell)2 GetTransferLeaderMessagePResponse (alluxio.grpc.GetTransferLeaderMessagePResponse)2 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)2 TimeoutException (java.util.concurrent.TimeoutException)2 AlluxioURI (alluxio.AlluxioURI)1 FileSystem (alluxio.client.file.FileSystem)1 PropertyKey (alluxio.conf.PropertyKey)1 FileSystemMasterClientServiceGrpc (alluxio.grpc.FileSystemMasterClientServiceGrpc)1 GrpcChannel (alluxio.grpc.GrpcChannel)1 QuorumServerState (alluxio.grpc.QuorumServerState)1 JournalType (alluxio.master.journal.JournalType)1 MultiProcessCluster (alluxio.multi.process.MultiProcessCluster)1 PortCoordination (alluxio.multi.process.PortCoordination)1 InetSocketAddress (java.net.InetSocketAddress)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Assert (org.junit.Assert)1