use of com.yahoo.vdslib.state.NodeState in project vespa by vespa-engine.
the class NodeStateChangeCheckerTest method createStorageNodeInfo.
private StorageNodeInfo createStorageNodeInfo(int index, State state) {
Distribution distribution = mock(Distribution.class);
Group group = new Group(2, "to");
when(distribution.getRootGroup()).thenReturn(group);
String clusterName = "Clustername";
Set<ConfiguredNode> configuredNodeIndexes = new HashSet<>();
ContentCluster cluster = new ContentCluster(clusterName, configuredNodeIndexes, distribution, minStorageNodesUp, 0.0);
String rpcAddress = "";
StorageNodeInfo storageNodeInfo = new StorageNodeInfo(cluster, index, false, rpcAddress, distribution);
storageNodeInfo.setReportedState(new NodeState(NodeType.STORAGE, state), 3);
return storageNodeInfo;
}
use of com.yahoo.vdslib.state.NodeState in project vespa by vespa-engine.
the class NodeStateChangeCheckerTest method transitionToSameState.
private NodeStateChangeChecker.Result transitionToSameState(State state, String oldDescription, String newDescription) {
ContentCluster cluster = createCluster(createNodes(4));
NodeStateChangeChecker nodeStateChangeChecker = createChangeChecker(cluster);
NodeState currentNodeState = createNodeState(state, oldDescription);
NodeState newNodeState = createNodeState(state, newDescription);
return nodeStateChangeChecker.evaluateTransition(nodeStorage, defaultAllUpClusterState(), SetUnitStateRequest.Condition.SAFE, currentNodeState, newNodeState);
}
use of com.yahoo.vdslib.state.NodeState in project vespa by vespa-engine.
the class NodeStateChangeCheckerTest method testCanUpgradeForce.
@Test
public void testCanUpgradeForce() {
NodeStateChangeChecker nodeStateChangeChecker = createChangeChecker(createCluster(createNodes(1)));
NodeState newState = new NodeState(NodeType.STORAGE, State.INITIALIZING);
NodeStateChangeChecker.Result result = nodeStateChangeChecker.evaluateTransition(nodeDistributor, defaultAllUpClusterState(), SetUnitStateRequest.Condition.FORCE, UP_NODE_STATE, newState);
assertTrue(result.settingWantedStateIsAllowed());
assertTrue(!result.wantedStateAlreadySet());
}
use of com.yahoo.vdslib.state.NodeState in project vespa by vespa-engine.
the class RpcVersionAutoDowngradeTest method setUpFakeCluster.
private void setUpFakeCluster(int nodeRpcVersion) throws Exception {
List<ConfiguredNode> configuredNodes = new ArrayList<>();
for (int i = 0; i < 10; i++) {
configuredNodes.add(new ConfiguredNode(i, false));
}
FleetControllerOptions options = new FleetControllerOptions("mycluster", configuredNodes);
setUpFleetController(false, options);
DummyVdsNodeOptions nodeOptions = new DummyVdsNodeOptions();
nodeOptions.stateCommunicationVersion = nodeRpcVersion;
List<DummyVdsNode> nodes = setUpVdsNodes(false, nodeOptions, true, configuredNodes);
for (DummyVdsNode node : nodes) {
node.setNodeState(new NodeState(node.getType(), State.UP).setMinUsedBits(20));
node.connect();
}
}
use of com.yahoo.vdslib.state.NodeState in project vespa by vespa-engine.
the class StateChangeHandlerTest method markNodeBackIntoSlobrok.
private void markNodeBackIntoSlobrok(Node node, State state) {
final ClusterState stateBefore = currentClusterState();
log.info("Marking " + node + " back in slobrok");
cluster.getNodeInfo(node).markRpcAddressLive();
nodeStateChangeHandler.handleReturnedRpcAddress(cluster.getNodeInfo(node));
nodeStateChangeHandler.handleNewReportedNodeState(stateBefore, cluster.getNodeInfo(node), new NodeState(node.getType(), state), nodeStateUpdateListener);
cluster.getNodeInfo(node).setReportedState(new NodeState(node.getType(), state), clock.getCurrentTimeInMillis());
}
Aggregations