use of org.apache.ignite.internal.processors.cluster.BaselineTopologyHistoryItem in project ignite by apache.
the class IgniteBaselineAffinityTopologyActivationTest method testBaselineHistorySyncWithOldNodeWithCompatibleHistory.
/**
*/
public void testBaselineHistorySyncWithOldNodeWithCompatibleHistory() throws Exception {
final long expectedBranchingHash0 = "A".hashCode() + "B".hashCode() + "C".hashCode();
final long expectedBranchingHash1 = "A".hashCode() + "B".hashCode();
BaselineTopologyHistoryVerifier verifier = new BaselineTopologyHistoryVerifier() {
@Override
public void verify(BaselineTopologyHistory bltHist) {
assertNotNull(bltHist);
assertEquals(2, bltHist.history().size());
BaselineTopologyHistoryItem histItem = bltHist.history().get(0);
assertEquals(1, histItem.branchingHistory().size());
long actualBranchingHash0 = histItem.branchingHistory().get(0);
assertEquals(expectedBranchingHash0, actualBranchingHash0);
histItem = bltHist.history().get(1);
assertEquals(1, histItem.branchingHistory().size());
long actualBranchingHash1 = histItem.branchingHistory().get(0);
assertEquals(expectedBranchingHash1, actualBranchingHash1);
}
};
Ignite nodeA = startGridWithConsistentId("A");
startGridWithConsistentId("B");
startGridWithConsistentId("C");
nodeA.active(true);
stopGrid("C", false);
nodeA.cluster().setBaselineTopology(baselineNodes(nodeA.cluster().forServers().nodes()));
stopGrid("B", false);
nodeA.cluster().setBaselineTopology(baselineNodes(nodeA.cluster().forServers().nodes()));
startGridWithConsistentId("B");
stopAllGrids(false);
startGridWithConsistentId("A");
Ignite nodeB = startGridWithConsistentId("B");
verifyBaselineTopologyHistoryOnNodes(verifier, new Ignite[] { nodeB });
}
use of org.apache.ignite.internal.processors.cluster.BaselineTopologyHistoryItem in project ignite by apache.
the class IgniteBaselineAffinityTopologyActivationTest method testBaselineHistorySyncWithNewNode.
/**
*/
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.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