use of org.apache.ignite.internal.processors.cluster.BaselineTopology in project ignite by apache.
the class IgniteBaselineAffinityTopologyActivationTest method testNodeWithOldBltIsAllowedToJoinCluster.
/**
* Test verifies that node with out-of-data but still compatible Baseline Topology is allowed to join the cluster.
*/
@Test
public void testNodeWithOldBltIsAllowedToJoinCluster() throws Exception {
final long expectedHash1 = (long) "A".hashCode() + "B".hashCode() + "C".hashCode();
BaselineTopologyVerifier verifier1 = new BaselineTopologyVerifier() {
@Override
public void verify(BaselineTopology blt) {
assertNotNull(blt);
assertEquals(3, blt.consistentIds().size());
long activationHash = U.field(blt, "branchingPntHash");
assertEquals(expectedHash1, activationHash);
}
};
final long expectedHash2 = (long) "A".hashCode() + "B".hashCode();
BaselineTopologyVerifier verifier2 = new BaselineTopologyVerifier() {
@Override
public void verify(BaselineTopology blt) {
assertNotNull(blt);
assertEquals(3, blt.consistentIds().size());
long activationHash = U.field(blt, "branchingPntHash");
assertEquals(expectedHash2, activationHash);
}
};
Ignite nodeA = startGridWithConsistentId("A");
Ignite nodeB = startGridWithConsistentId("B");
Ignite nodeC = startGridWithConsistentId("C");
nodeC.cluster().active(true);
verifyBaselineTopologyOnNodes(verifier1, new Ignite[] { nodeA, nodeB, nodeC });
stopAllGrids(false);
nodeA = startGridWithConsistentId("A");
nodeB = startGridWithConsistentId("B");
nodeB.cluster().active(true);
verifyBaselineTopologyOnNodes(verifier2, new Ignite[] { nodeA, nodeB });
stopAllGrids(false);
nodeA = startGridWithConsistentId("A");
nodeB = startGridWithConsistentId("B");
nodeC = startGridWithConsistentId("C");
awaitPartitionMapExchange();
verifyBaselineTopologyOnNodes(verifier1, new Ignite[] { nodeA, nodeB, nodeC });
}
Aggregations