use of org.apache.ignite.internal.processors.cluster.BaselineTopologyHistory in project ignite by apache.
the class IgniteBaselineAffinityTopologyActivationTest method verifyBaselineTopologyHistoryOnNodes.
/**
*/
private void verifyBaselineTopologyHistoryOnNodes(BaselineTopologyHistoryVerifier bltHistVerifier, Ignite[] igs) {
for (Ignite ig : igs) {
BaselineTopologyHistory blt = getBaselineTopologyHistory(ig);
bltHistVerifier.verify(blt);
}
}
use of org.apache.ignite.internal.processors.cluster.BaselineTopologyHistory in project ignite by apache.
the class IgniteBaselineAffinityTopologyActivationTest method testBaselineHistorySyncWithOldNodeWithCompatibleHistory.
/**
*/
@Test
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.cluster().baselineAutoAdjustEnabled(false);
nodeA.cluster().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.BaselineTopologyHistory in project ignite by apache.
the class IgniteBaselineAffinityTopologyActivationTest method _testBaselineTopologyHistoryIsDeletedOnBaselineDelete.
/**
* Restore this test when requirements for BaselineTopology deletion are clarified and this feature
* is covered with more tests.
*/
public void _testBaselineTopologyHistoryIsDeletedOnBaselineDelete() throws Exception {
BaselineTopologyHistoryVerifier verifier = new BaselineTopologyHistoryVerifier() {
@Override
public void verify(BaselineTopologyHistory bltHist) {
assertNotNull(bltHist);
assertEquals(0, bltHist.history().size());
}
};
Ignite nodeA = startGridWithConsistentId("A");
startGridWithConsistentId("B");
startGridWithConsistentId("C");
nodeA.active(true);
stopAllGrids(false);
nodeA = startGridWithConsistentId("A");
startGridWithConsistentId("B");
nodeA.active(true);
nodeA.cluster().setBaselineTopology(baselineNodes(nodeA.cluster().forServers().nodes()));
stopAllGrids(false);
nodeA = startGridWithConsistentId("A");
nodeA.active(true);
nodeA.cluster().setBaselineTopology(baselineNodes(nodeA.cluster().forServers().nodes()));
stopAllGrids(false);
final Ignite node = startGridWithConsistentId("A");
boolean activated = GridTestUtils.waitForCondition(new GridAbsPredicate() {
@Override
public boolean apply() {
return node.active();
}
}, 10_000);
assertTrue(activated);
node.cluster().setBaselineTopology(null);
verifyBaselineTopologyHistoryOnNodes(verifier, new Ignite[] { node });
stopAllGrids(false);
nodeA = startGridWithConsistentId("A");
verifyBaselineTopologyHistoryOnNodes(verifier, new Ignite[] { nodeA });
}
use of org.apache.ignite.internal.processors.cluster.BaselineTopologyHistory in project ignite by apache.
the class IgniteBaselineAffinityTopologyActivationTest method checkBaselineTopologyOnNode.
/**
* @param ig Ignite.
* @param expBltId Expected BaselineTopology ID.
* @param expBltHistSize Expected Baseline history size.
* @param expBranchingHistSize Expected branching history size.
* @param expActivationHash Expected activation hash.
*/
private void checkBaselineTopologyOnNode(Ignite ig, int expBltId, int expBltHistSize, int expBranchingHistSize, long expActivationHash) {
BaselineTopology blt = getBaselineTopology(ig);
BaselineTopologyHistory bltHist = getBaselineTopologyHistory(ig);
assertNotNull(bltHist);
assertEquals(expBltId, blt.id());
assertEquals(expBltHistSize, bltHist.history().size());
BaselineTopologyHistoryItem histItem = bltHist.history().get(0);
assertEquals(expBranchingHistSize, histItem.branchingHistory().size());
assertEquals(expActivationHash, (long) histItem.branchingHistory().get(0));
}
use of org.apache.ignite.internal.processors.cluster.BaselineTopologyHistory in project ignite by apache.
the class IgniteBaselineAffinityTopologyActivationTest method testBaselineTopologyRemainsTheSameOnClusterDeactivation.
/**
* Verifies that neither BaselineTopology nor BaselineTopologyHistory are changed when cluster is deactivated.
*/
@Test
public void testBaselineTopologyRemainsTheSameOnClusterDeactivation() throws Exception {
startGrids(2);
IgniteEx srv = grid(0);
srv.cluster().active(true);
awaitPartitionMapExchange();
assertTrue(srv.cluster().active());
srv.cluster().active(false);
BaselineTopology blt = getBaselineTopology(srv);
BaselineTopologyHistory bltHist = getBaselineTopologyHistory(srv);
assertEquals(0, blt.id());
assertEquals(2, blt.consistentIds().size());
assertEquals(1, blt.branchingHistory().size());
assertEquals(0, bltHist.history().size());
}
Aggregations