Search in sources :

Example 6 with Node

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

the class ClusterStateGeneratorTest method do_test_storage_node_with_no_init_progress.

private String do_test_storage_node_with_no_init_progress(State wantedState) {
    final ClusterFixture fixture = ClusterFixture.forFlatCluster(3).bringEntireClusterUp().reportStorageNodeState(0, new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.5)).proposeStorageNodeWantedState(0, wantedState);
    final NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 0));
    nodeInfo.setInitProgressTime(10_000);
    final ClusterStateGenerator.Params params = fixture.generatorParams().maxInitProgressTime(1000).currentTimeInMilllis(11_000);
    final AnnotatedClusterState state = ClusterStateGenerator.generatedStateFrom(params);
    return state.toString();
}
Also used : NodeState(com.yahoo.vdslib.state.NodeState) ConfiguredNode(com.yahoo.vdslib.distribution.ConfiguredNode) ClusterFixture.storageNode(com.yahoo.vespa.clustercontroller.core.ClusterFixture.storageNode) Node(com.yahoo.vdslib.state.Node) HasStateReasonForNode.hasStateReasonForNode(com.yahoo.vespa.clustercontroller.core.matchers.HasStateReasonForNode.hasStateReasonForNode)

Example 7 with Node

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

the class ClusterStateGeneratorTest method configured_zero_init_progress_time_disables_auto_init_to_down_feature.

@Test
public void configured_zero_init_progress_time_disables_auto_init_to_down_feature() {
    final ClusterFixture fixture = ClusterFixture.forFlatCluster(3).bringEntireClusterUp().reportStorageNodeState(0, new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.5));
    final NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 0));
    nodeInfo.setInitProgressTime(10_000);
    final ClusterStateGenerator.Params params = fixture.generatorParams().maxInitProgressTime(0).currentTimeInMilllis(11_000);
    final AnnotatedClusterState state = ClusterStateGenerator.generatedStateFrom(params);
    assertThat(state.toString(), equalTo("distributor:3 storage:3 .0.s:i .0.i:0.5"));
}
Also used : NodeState(com.yahoo.vdslib.state.NodeState) ConfiguredNode(com.yahoo.vdslib.distribution.ConfiguredNode) ClusterFixture.storageNode(com.yahoo.vespa.clustercontroller.core.ClusterFixture.storageNode) Node(com.yahoo.vdslib.state.Node) HasStateReasonForNode.hasStateReasonForNode(com.yahoo.vespa.clustercontroller.core.matchers.HasStateReasonForNode.hasStateReasonForNode) Test(org.junit.Test)

Example 8 with Node

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

the class SlobrokClient method getSlobrokData.

private Map<Node, SlobrokData> getSlobrokData(String pattern) {
    Map<Node, SlobrokData> result = new TreeMap<>();
    Mirror.Entry[] entries = mirror.lookup(pattern);
    log.log(LogLevel.SPAM, "Looking for slobrok entries with pattern '" + pattern + "'. Found " + entries.length + " entries.");
    for (Mirror.Entry entry : entries) {
        StringTokenizer st = new StringTokenizer(entry.getName(), "/");
        String addressType = st.nextToken();
        // skip
        String cluster = st.nextToken();
        NodeType nodeType = NodeType.get(st.nextToken());
        Integer nodeIndex = Integer.valueOf(st.nextToken());
        // skip
        String service = (st.hasMoreTokens() ? st.nextToken() : "");
        assert (addressType.equals("storage"));
        Node n = new Node(nodeType, nodeIndex);
        result.put(n, new SlobrokData(n, entry.getSpec()));
    }
    return result;
}
Also used : Node(com.yahoo.vdslib.state.Node) NodeType(com.yahoo.vdslib.state.NodeType) Mirror(com.yahoo.jrt.slobrok.api.Mirror)

Example 9 with Node

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

the class EventLogTest method testNoEventsDoNotThrowException.

@Test
public void testNoEventsDoNotThrowException() {
    initialize(metricUpdater);
    StringBuilder builder = new StringBuilder();
    Node nonExistantNode = new Node(NodeType.DISTRIBUTOR, 0);
    eventLog.writeHtmlState(builder, nonExistantNode);
    assertNotEquals("", builder.toString());
}
Also used : Node(com.yahoo.vdslib.state.Node) Test(org.junit.Test)

Example 10 with Node

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

the class FleetControllerTest method waitForNodeStateReported.

protected void waitForNodeStateReported(int nodeIndex, NodeState state, int ms) {
    long timeoutAtTime = System.currentTimeMillis() + ms;
    while (true) {
        Node node = nodes.get(nodeIndex).getNode();
        NodeState ns = fleetController.getReportedNodeState(node);
        if ((ns == null && state == null) || (ns != null && state != null && ns.equals(state)))
            break;
        if (System.currentTimeMillis() > timeoutAtTime) {
            throw new IllegalStateException("Failed to find " + node + " in nodestate " + state + " before timeout of " + ms + " milliseconds.");
        }
    }
}
Also used : NodeState(com.yahoo.vdslib.state.NodeState) Node(com.yahoo.vdslib.state.Node) ConfiguredNode(com.yahoo.vdslib.distribution.ConfiguredNode)

Aggregations

Node (com.yahoo.vdslib.state.Node)65 Test (org.junit.Test)34 NodeState (com.yahoo.vdslib.state.NodeState)32 ConfiguredNode (com.yahoo.vdslib.distribution.ConfiguredNode)31 ClusterFixture.storageNode (com.yahoo.vespa.clustercontroller.core.ClusterFixture.storageNode)15 HasStateReasonForNode.hasStateReasonForNode (com.yahoo.vespa.clustercontroller.core.matchers.HasStateReasonForNode.hasStateReasonForNode)15 ClusterState (com.yahoo.vdslib.state.ClusterState)9 NodeInfo (com.yahoo.vespa.clustercontroller.core.NodeInfo)6 NodeType (com.yahoo.vdslib.state.NodeType)5 PrintWriter (java.io.PrintWriter)5 StringWriter (java.io.StringWriter)5 Request (com.yahoo.jrt.Request)4 State (com.yahoo.vdslib.state.State)4 IOException (java.io.IOException)4 Spec (com.yahoo.jrt.Spec)3 StringValue (com.yahoo.jrt.StringValue)3 Supervisor (com.yahoo.jrt.Supervisor)3 Target (com.yahoo.jrt.Target)3 Transport (com.yahoo.jrt.Transport)3 TreeMap (java.util.TreeMap)3