Search in sources :

Example 41 with NodeState

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;
}
Also used : Group(com.yahoo.vdslib.distribution.Group) NodeState(com.yahoo.vdslib.state.NodeState) Distribution(com.yahoo.vdslib.distribution.Distribution) ConfiguredNode(com.yahoo.vdslib.distribution.ConfiguredNode) StringContains.containsString(org.hamcrest.core.StringContains.containsString) HashSet(java.util.HashSet)

Example 42 with NodeState

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);
}
Also used : NodeState(com.yahoo.vdslib.state.NodeState)

Example 43 with NodeState

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());
}
Also used : NodeState(com.yahoo.vdslib.state.NodeState) Test(org.junit.Test)

Example 44 with NodeState

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();
    }
}
Also used : NodeState(com.yahoo.vdslib.state.NodeState) ConfiguredNode(com.yahoo.vdslib.distribution.ConfiguredNode) ArrayList(java.util.ArrayList)

Example 45 with NodeState

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());
}
Also used : ClusterState(com.yahoo.vdslib.state.ClusterState) NodeState(com.yahoo.vdslib.state.NodeState)

Aggregations

NodeState (com.yahoo.vdslib.state.NodeState)68 Node (com.yahoo.vdslib.state.Node)31 Test (org.junit.Test)30 ConfiguredNode (com.yahoo.vdslib.distribution.ConfiguredNode)21 ClusterState (com.yahoo.vdslib.state.ClusterState)11 NodeInfo (com.yahoo.vespa.clustercontroller.core.NodeInfo)6 Request (com.yahoo.jrt.Request)5 Target (com.yahoo.jrt.Target)5 State (com.yahoo.vdslib.state.State)5 ClusterFixture.storageNode (com.yahoo.vespa.clustercontroller.core.ClusterFixture.storageNode)5 HasStateReasonForNode.hasStateReasonForNode (com.yahoo.vespa.clustercontroller.core.matchers.HasStateReasonForNode.hasStateReasonForNode)5 Spec (com.yahoo.jrt.Spec)4 StringValue (com.yahoo.jrt.StringValue)4 Supervisor (com.yahoo.jrt.Supervisor)4 Transport (com.yahoo.jrt.Transport)4 DiskState (com.yahoo.vdslib.state.DiskState)4 ArrayList (java.util.ArrayList)4 PrintWriter (java.io.PrintWriter)3 StringWriter (java.io.StringWriter)3 HashSet (java.util.HashSet)3