Search in sources :

Example 51 with Node

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

the class ClusterStateGeneratorTest method crash_count_not_exceeding_limit_does_not_mark_node_as_down.

@Test
public void crash_count_not_exceeding_limit_does_not_mark_node_as_down() {
    final ClusterFixture fixture = ClusterFixture.forFlatCluster(5).bringEntireClusterUp();
    final ClusterStateGenerator.Params params = fixture.generatorParams().maxPrematureCrashes(10);
    final NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 3));
    // "Max crashes" range is inclusive
    nodeInfo.setPrematureCrashCount(10);
    final AnnotatedClusterState state = ClusterStateGenerator.generatedStateFrom(params);
    assertThat(state.toString(), equalTo("distributor:5 storage:5"));
}
Also used : 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 52 with Node

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

the class ClusterStateGeneratorTest method fully_observed_distributor_timestamp_not_included_in_state.

@Test
public void fully_observed_distributor_timestamp_not_included_in_state() {
    final NodeState nodeState = new NodeState(NodeType.DISTRIBUTOR, State.UP);
    nodeState.setStartTimestamp(6000);
    final ClusterFixture fixture = ClusterFixture.forFlatCluster(5).bringEntireClusterUp().reportDistributorNodeState(0, nodeState);
    final NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.DISTRIBUTOR, 0));
    nodeInfo.setStartTimestamp(6000);
    final AnnotatedClusterState state = generateFromFixtureWithDefaultParams(fixture);
    assertThat(state.toString(), equalTo("distributor:5 storage: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 53 with Node

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

the class ClusterStateGeneratorTest method fully_observed_storage_node_timestamp_not_included_in_state.

@Test
public void fully_observed_storage_node_timestamp_not_included_in_state() {
    final NodeState nodeState = new NodeState(NodeType.STORAGE, State.UP);
    nodeState.setStartTimestamp(5000);
    final ClusterFixture fixture = ClusterFixture.forFlatCluster(5).bringEntireClusterUp().reportStorageNodeState(0, nodeState);
    final NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 0));
    nodeInfo.setStartTimestamp(5000);
    final AnnotatedClusterState state = generateFromFixtureWithDefaultParams(fixture);
    assertThat(state.toString(), equalTo("distributor:5 storage: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 54 with Node

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

the class ClusterStateGeneratorTest method do_test_change_within_node_transition_time_window_generates_maintenance.

private void do_test_change_within_node_transition_time_window_generates_maintenance(State reportedState) {
    final ClusterFixture fixture = ClusterFixture.forFlatCluster(5).bringEntireClusterUp();
    final ClusterStateGenerator.Params params = fixture.generatorParams().currentTimeInMilllis(10_000).transitionTimes(2000);
    fixture.reportStorageNodeState(1, reportedState);
    final NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 1));
    // Node 1 transitioned to reported `reportedState` at time 9000ms after epoch. This means that according to the
    // above transition time config, it should remain in generated maintenance mode until time 11000ms,
    // at which point it should finally transition to generated state Down.
    nodeInfo.setTransitionTime(9000);
    {
        final AnnotatedClusterState state = ClusterStateGenerator.generatedStateFrom(params);
        assertThat(state.toString(), equalTo("distributor:5 storage:5 .1.s:m"));
    }
    nodeInfo.setTransitionTime(10999);
    {
        final AnnotatedClusterState state = ClusterStateGenerator.generatedStateFrom(params);
        assertThat(state.toString(), equalTo("distributor:5 storage:5 .1.s:m"));
    }
}
Also used : 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 55 with Node

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

the class ClusterStateGeneratorTest method crash_count_exceeding_limit_marks_node_as_down.

@Test
public void crash_count_exceeding_limit_marks_node_as_down() {
    final ClusterFixture fixture = ClusterFixture.forFlatCluster(5).bringEntireClusterUp();
    final ClusterStateGenerator.Params params = fixture.generatorParams().maxPrematureCrashes(10);
    final NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 3));
    nodeInfo.setPrematureCrashCount(11);
    final AnnotatedClusterState state = ClusterStateGenerator.generatedStateFrom(params);
    assertThat(state.toString(), equalTo("distributor:5 storage:5 .3.s:d"));
}
Also used : 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)

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