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();
}
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();
}
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();
}
Aggregations