use of alluxio.grpc.GetTransferLeaderMessagePResponse 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();
}
Aggregations