Search in sources :

Example 6 with ClusterState

use of com.yahoo.vdslib.state.ClusterState in project vespa by vespa-engine.

the class ClusterFixture method proposeDistributorWantedState.

public ClusterFixture proposeDistributorWantedState(final int index, State state) {
    final ClusterState stateBefore = rawGeneratedClusterState();
    final Node node = new Node(NodeType.DISTRIBUTOR, index);
    final NodeState nodeState = new NodeState(NodeType.DISTRIBUTOR, state);
    nodeState.setDescription("mockdesc");
    NodeInfo nodeInfo = cluster.getNodeInfo(node);
    nodeInfo.setWantedState(nodeState);
    nodeStateChangeHandler.proposeNewNodeState(stateBefore, nodeInfo, nodeState);
    return this;
}
Also used : ClusterState(com.yahoo.vdslib.state.ClusterState) NodeState(com.yahoo.vdslib.state.NodeState) ConfiguredNode(com.yahoo.vdslib.distribution.ConfiguredNode) Node(com.yahoo.vdslib.state.Node)

Example 7 with ClusterState

use of com.yahoo.vdslib.state.ClusterState in project vespa by vespa-engine.

the class ClusterFixture method doReportNodeState.

private void doReportNodeState(final Node node, final NodeState nodeState) {
    final ClusterState stateBefore = rawGeneratedClusterState();
    NodeStateOrHostInfoChangeHandler handler = mock(NodeStateOrHostInfoChangeHandler.class);
    NodeInfo nodeInfo = cluster.getNodeInfo(node);
    nodeStateChangeHandler.handleNewReportedNodeState(stateBefore, nodeInfo, nodeState, handler);
    nodeInfo.setReportedState(nodeState, timer.getCurrentTimeInMillis());
}
Also used : ClusterState(com.yahoo.vdslib.state.ClusterState) NodeStateOrHostInfoChangeHandler(com.yahoo.vespa.clustercontroller.core.listeners.NodeStateOrHostInfoChangeHandler)

Example 8 with ClusterState

use of com.yahoo.vdslib.state.ClusterState in project vespa by vespa-engine.

the class SlimeClusterStateBundleCodec method decode.

@Override
public ClusterStateBundle decode(EncodedClusterStateBundle encodedClusterStateBundle) {
    byte[] uncompressed = compressor.decompress(encodedClusterStateBundle.getCompression());
    Slime slime = BinaryFormat.decode(uncompressed);
    Inspector root = slime.get();
    Inspector states = root.field("states");
    ClusterState baseline = ClusterState.stateFromString(states.field("baseline").asString());
    Inspector spaces = states.field("spaces");
    Map<String, AnnotatedClusterState> derivedStates = new HashMap<>();
    spaces.traverse(((ObjectTraverser) (key, value) -> {
        derivedStates.put(key, AnnotatedClusterState.withoutAnnotations(ClusterState.stateFromString(value.asString())));
    }));
    return ClusterStateBundle.of(AnnotatedClusterState.withoutAnnotations(baseline), derivedStates);
}
Also used : AnnotatedClusterState(com.yahoo.vespa.clustercontroller.core.AnnotatedClusterState) ClusterState(com.yahoo.vdslib.state.ClusterState) HashMap(java.util.HashMap) AnnotatedClusterState(com.yahoo.vespa.clustercontroller.core.AnnotatedClusterState)

Example 9 with ClusterState

use of com.yahoo.vdslib.state.ClusterState in project vespa by vespa-engine.

the class EventDiffCalculator method emitWholeClusterDiffEvent.

private static void emitWholeClusterDiffEvent(final PerStateParams params, final List<Event> events) {
    final ClusterState fromState = params.fromState.getClusterState();
    final ClusterState toState = params.toState.getClusterState();
    if (clusterHasTransitionedToUpState(fromState, toState)) {
        events.add(createClusterEvent("Enough nodes available for system to become up", params));
    } else if (clusterHasTransitionedToDownState(fromState, toState)) {
        if (clusterDownBecause(params, ClusterStateReason.TOO_FEW_STORAGE_NODES_AVAILABLE)) {
            events.add(createClusterEvent("Too few storage nodes available in cluster. Setting cluster state down", params));
        } else if (clusterDownBecause(params, ClusterStateReason.TOO_FEW_DISTRIBUTOR_NODES_AVAILABLE)) {
            events.add(createClusterEvent("Too few distributor nodes available in cluster. Setting cluster state down", params));
        } else if (clusterDownBecause(params, ClusterStateReason.TOO_LOW_AVAILABLE_STORAGE_NODE_RATIO)) {
            events.add(createClusterEvent("Too low ratio of available storage nodes. Setting cluster state down", params));
        } else if (clusterDownBecause(params, ClusterStateReason.TOO_LOW_AVAILABLE_DISTRIBUTOR_NODE_RATIO)) {
            events.add(createClusterEvent("Too low ratio of available distributor nodes. Setting cluster state down", params));
        } else {
            events.add(createClusterEvent("Cluster is down", params));
        }
    }
}
Also used : ClusterState(com.yahoo.vdslib.state.ClusterState)

Example 10 with ClusterState

use of com.yahoo.vdslib.state.ClusterState in project vespa by vespa-engine.

the class EventDiffCalculator method emitPerNodeDiffEvents.

private static void emitPerNodeDiffEvents(final PerStateParams params, final List<Event> events) {
    final ContentCluster cluster = params.cluster;
    final ClusterState fromState = params.fromState.getClusterState();
    final ClusterState toState = params.toState.getClusterState();
    for (ConfiguredNode node : cluster.getConfiguredNodes().values()) {
        for (NodeType nodeType : NodeType.getTypes()) {
            final Node n = new Node(nodeType, node.index());
            emitSingleNodeEvents(params, events, cluster, fromState, toState, n);
        }
    }
}
Also used : ClusterState(com.yahoo.vdslib.state.ClusterState) ConfiguredNode(com.yahoo.vdslib.distribution.ConfiguredNode) NodeType(com.yahoo.vdslib.state.NodeType) ConfiguredNode(com.yahoo.vdslib.distribution.ConfiguredNode) Node(com.yahoo.vdslib.state.Node)

Aggregations

ClusterState (com.yahoo.vdslib.state.ClusterState)38 Test (org.junit.Test)11 NodeState (com.yahoo.vdslib.state.NodeState)10 Node (com.yahoo.vdslib.state.Node)8 BucketId (com.yahoo.document.BucketId)6 ConfiguredNode (com.yahoo.vdslib.distribution.ConfiguredNode)6 State (com.yahoo.vdslib.state.State)4 Request (com.yahoo.jrt.Request)2 Spec (com.yahoo.jrt.Spec)2 Supervisor (com.yahoo.jrt.Supervisor)2 Target (com.yahoo.jrt.Target)2 Transport (com.yahoo.jrt.Transport)2 StringWriter (java.io.StringWriter)2 HashMap (java.util.HashMap)2 ParseException (com.yahoo.document.select.parser.ParseException)1 StringValue (com.yahoo.jrt.StringValue)1 Distribution (com.yahoo.vdslib.distribution.Distribution)1 NodeType (com.yahoo.vdslib.state.NodeType)1 AnnotatedClusterState (com.yahoo.vespa.clustercontroller.core.AnnotatedClusterState)1 HostInfo (com.yahoo.vespa.clustercontroller.core.hostinfo.HostInfo)1