Search in sources :

Example 6 with NodeState

use of com.yahoo.vdslib.state.NodeState 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 NodeState

use of com.yahoo.vdslib.state.NodeState 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 NodeState

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

the class ClusterStateGeneratorTest method distributor_nodes_in_init_mode_are_not_mapped_to_down.

@Test
public void distributor_nodes_in_init_mode_are_not_mapped_to_down() {
    final NodeState initWhileListingBuckets = new NodeState(NodeType.DISTRIBUTOR, State.INITIALIZING);
    initWhileListingBuckets.setInitProgress(0.0);
    final ClusterFixture fixture = ClusterFixture.forFlatCluster(3).bringEntireClusterUp().reportDistributorNodeState(1, initWhileListingBuckets);
    final AnnotatedClusterState state = generateFromFixtureWithDefaultParams(fixture);
    assertThat(state.toString(), equalTo("distributor:3 .1.s:i .1.i:0.0 storage:3"));
}
Also used : NodeState(com.yahoo.vdslib.state.NodeState) Test(org.junit.Test)

Example 9 with NodeState

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

the class ClusterStateGeneratorTest method non_observed_storage_node_start_timestamp_is_included_in_state.

@Test
public void non_observed_storage_node_start_timestamp_is_included_in_state() {
    final NodeState nodeState = new NodeState(NodeType.STORAGE, State.UP);
    // A reported state timestamp that is not yet marked as observed in the NodeInfo
    // for the same node is considered not observed by other nodes and must therefore
    // be included in the generated cluster state
    nodeState.setStartTimestamp(5000);
    final ClusterFixture fixture = ClusterFixture.forFlatCluster(5).bringEntireClusterUp().reportStorageNodeState(0, nodeState);
    final AnnotatedClusterState state = generateFromFixtureWithDefaultParams(fixture);
    assertThat(state.toString(), equalTo("distributor:5 storage:5 .0.t:5000"));
}
Also used : NodeState(com.yahoo.vdslib.state.NodeState) Test(org.junit.Test)

Example 10 with NodeState

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

the class DistributionBitCountTest method testStorageNodeReportingLowerBitCount.

/**
 * Test that then storage node report lower bit count, but another storage node with equally low bitcount, the fleetcontroller does nothing.
 * Test that then storage node report lower bit count, and then becomes the smallest, the fleetcontroller adjusts to use that bit in system state.
 */
@Test
public void testStorageNodeReportingLowerBitCount() throws Exception {
    setUpSystem("DistributionBitCountTest::testStorageNodeReportingLowerBitCount");
    nodes.get(1).setNodeState(new NodeState(NodeType.STORAGE, State.UP).setMinUsedBits(13));
    ClusterState currentState = waitForState("version:\\d+ bits:13 distributor:10 storage:10");
    int version = currentState.getVersion();
    nodes.get(3).setNodeState(new NodeState(NodeType.STORAGE, State.UP).setMinUsedBits(15));
    assertEquals(version, currentState.getVersion());
    nodes.get(3).setNodeState(new NodeState(NodeType.STORAGE, State.UP).setMinUsedBits(13));
    assertEquals(version, currentState.getVersion());
    nodes.get(3).setNodeState(new NodeState(NodeType.STORAGE, State.UP).setMinUsedBits(12));
    waitForState("version:\\d+ bits:12 distributor:10 storage:10");
}
Also used : ClusterState(com.yahoo.vdslib.state.ClusterState) NodeState(com.yahoo.vdslib.state.NodeState) Test(org.junit.Test)

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