use of org.apache.ignite.internal.processors.cluster.BaselineTopologyHistory in project ignite by apache.
the class IgniteBaselineAffinityTopologyActivationTest method testBaselineHistorySyncWithNewNode.
/**
*/
@Test
public void testBaselineHistorySyncWithNewNode() throws Exception {
final long expectedBranchingHash = "A".hashCode() + "B".hashCode() + "C".hashCode();
BaselineTopologyHistoryVerifier verifier = new BaselineTopologyHistoryVerifier() {
@Override
public void verify(BaselineTopologyHistory bltHist) {
assertNotNull(bltHist);
assertEquals(1, bltHist.history().size());
BaselineTopologyHistoryItem histItem = bltHist.history().get(0);
assertEquals(1, histItem.branchingHistory().size());
long actualBranchingHash = histItem.branchingHistory().get(0);
assertEquals(expectedBranchingHash, actualBranchingHash);
}
};
Ignite nodeA = startGridWithConsistentId("A");
startGridWithConsistentId("B");
startGridWithConsistentId("C");
nodeA.cluster().baselineAutoAdjustEnabled(false);
nodeA.cluster().active(true);
stopGrid("C", false);
nodeA.cluster().setBaselineTopology(baselineNodes(nodeA.cluster().forServers().nodes()));
startGridWithConsistentId("D");
stopAllGrids(false);
Ignite nodeD = startGridWithConsistentId("D");
verifyBaselineTopologyHistoryOnNodes(verifier, new Ignite[] { nodeD });
}
Aggregations