use of org.apache.ignite.cluster.BaselineNode in project ignite by apache.
the class BaselineTopology method calculateTopologyHash.
/**
* @param nodes Nodes.
*/
private long calculateTopologyHash(Collection<? extends BaselineNode> nodes) {
long res = 0;
Set<Object> bltConsIds = nodeMap.keySet();
for (BaselineNode node : nodes) {
if (bltConsIds.contains(node.consistentId()))
res += (long) node.consistentId().hashCode();
}
return res;
}
use of org.apache.ignite.cluster.BaselineNode in project ignite by apache.
the class IgniteBaselineAffinityTopologyActivationTest method testAutoActivationWithBaselineTopologyPreset.
/**
* Verifies that grid is autoactivated when full BaselineTopology is preset even on one node
* and then all other nodes from BaselineTopology are started.
*/
public void testAutoActivationWithBaselineTopologyPreset() throws Exception {
Ignite ig = startGridWithConsistentId("A");
ig.active(true);
ig.cluster().setBaselineTopology(Arrays.asList(new BaselineNode[] { createBaselineNodeWithConsId("A"), createBaselineNodeWithConsId("B"), createBaselineNodeWithConsId("C") }));
stopAllGrids();
final Ignite ig1 = startGridWithConsistentId("A");
startGridWithConsistentId("B");
startGridWithConsistentId("C");
boolean activated = GridTestUtils.waitForCondition(new GridAbsPredicate() {
@Override
public boolean apply() {
return ig1.active();
}
}, 10_000);
assertTrue(activated);
}
use of org.apache.ignite.cluster.BaselineNode in project ignite by apache.
the class IgniteBaselineAffinityTopologyActivationTest method testOnlineNodesCannotBeRemovedFromBaselineTopology.
/**
* Verifies that online nodes cannot be removed from BaselineTopology (this may change in future).
*/
public void testOnlineNodesCannotBeRemovedFromBaselineTopology() throws Exception {
Ignite nodeA = startGridWithConsistentId("A");
Ignite nodeB = startGridWithConsistentId("B");
Ignite nodeC = startGridWithConsistentId("OnlineConsID");
nodeC.active(true);
boolean expectedExceptionIsThrown = false;
try {
nodeC.cluster().setBaselineTopology(Arrays.asList((BaselineNode) nodeA.cluster().localNode(), nodeB.cluster().localNode()));
} catch (IgniteException e) {
String errMsg = e.getMessage();
assertTrue(errMsg.startsWith("Removing online nodes"));
assertTrue(errMsg.contains("[OnlineConsID]"));
expectedExceptionIsThrown = true;
}
assertTrue(expectedExceptionIsThrown);
}
Aggregations