Search in sources :

Example 1 with DiskState

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

the class ClusterStateGeneratorTest method reported_disk_state_not_hidden_by_wanted_state.

@Test
public void reported_disk_state_not_hidden_by_wanted_state() {
    final NodeState stateWithDisks = new NodeState(NodeType.STORAGE, State.UP);
    stateWithDisks.setDiskCount(5);
    stateWithDisks.setDiskState(3, new DiskState(State.DOWN));
    final ClusterFixture fixture = ClusterFixture.forFlatCluster(9).bringEntireClusterUp().reportStorageNodeState(2, stateWithDisks).proposeStorageNodeWantedState(2, State.RETIRED).reportStorageNodeState(3, stateWithDisks).proposeStorageNodeWantedState(3, State.MAINTENANCE);
    final AnnotatedClusterState state = generateFromFixtureWithDefaultParams(fixture);
    // We do not publish disk states for nodes in Down state. This differs from how the
    // legacy controller did things, but such states cannot be counted on for ideal state
    // calculations either way. In particular, reported disk states are not persisted and
    // only exist transiently in the cluster controller's memory. A controller restart is
    // sufficient to clear all disk states that have been incidentally remembered for now
    // downed nodes.
    // The keen reader may choose to convince themselves of this independently by reading the
    // code in com.yahoo.vdslib.distribution.Distribution#getIdealStorageNodes and observing
    // how disk states for nodes that are in a down-state are never considered.
    assertThat(state.toString(), equalTo("distributor:9 storage:9 .2.s:r .2.d:5 .2.d.3.s:d " + ".3.s:m .3.d:5 .3.d.3.s:d"));
}
Also used : NodeState(com.yahoo.vdslib.state.NodeState) DiskState(com.yahoo.vdslib.state.DiskState) Test(org.junit.Test)

Example 2 with DiskState

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

the class GroupAutoTakedownTest method disk_states_are_preserved_across_group_down_up_edge.

@Test
public void disk_states_are_preserved_across_group_down_up_edge() {
    ClusterFixture fixture = createFixtureForAllUpHierarchicCluster(DistributionBuilder.withGroups(3).eachWithNodeCount(2), 0.51);
    final NodeState newState = new NodeState(NodeType.STORAGE, State.UP);
    newState.setDiskCount(7);
    newState.setDiskState(5, new DiskState(State.DOWN));
    fixture.reportStorageNodeState(4, newState);
    assertEquals("distributor:6 storage:6 .4.d:7 .4.d.5.s:d", fixture.generatedClusterState());
    assertEquals("distributor:6 storage:4", stateAfterStorageTransition(fixture, 5, State.DOWN));
    assertEquals("distributor:6 storage:6 .4.d:7 .4.d.5.s:d", stateAfterStorageTransition(fixture, 5, State.UP));
}
Also used : NodeState(com.yahoo.vdslib.state.NodeState) DiskState(com.yahoo.vdslib.state.DiskState) Test(org.junit.Test)

Example 3 with DiskState

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

the class ClusterStateGeneratorTest method storage_reported_disk_state_included_in_generated_state.

@Test
public void storage_reported_disk_state_included_in_generated_state() {
    final NodeState stateWithDisks = new NodeState(NodeType.STORAGE, State.UP);
    stateWithDisks.setDiskCount(7);
    stateWithDisks.setDiskState(5, new DiskState(State.DOWN));
    final ClusterFixture fixture = ClusterFixture.forFlatCluster(9).bringEntireClusterUp().reportStorageNodeState(2, stateWithDisks);
    final AnnotatedClusterState state = generateFromFixtureWithDefaultParams(fixture);
    assertThat(state.toString(), equalTo("distributor:9 storage:9 .2.d:7 .2.d.5.s:d"));
}
Also used : NodeState(com.yahoo.vdslib.state.NodeState) DiskState(com.yahoo.vdslib.state.DiskState) Test(org.junit.Test)

Example 4 with DiskState

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

the class PartitionStateRequest method calculateResult.

@Override
public Response.PartitionResponse calculateResult(RemoteClusterControllerTask.Context context) throws StateRestApiException {
    Response.PartitionResponse result = new Response.PartitionResponse();
    if (verboseReports.contains(VerboseReport.STATISTICS)) {
        fillInMetrics(context.cluster.getNodeInfo(id.getNode()).getHostInfo().getMetrics(), result);
    }
    NodeState nodeState = context.currentConsolidatedState.getNodeState(id.getNode());
    DiskState diskState = nodeState.getDiskState(id.getPartitionIndex());
    result.addState("generated", new Response.UnitStateImpl(diskState));
    return result;
}
Also used : Response(com.yahoo.vespa.clustercontroller.core.restapiv2.Response) NodeState(com.yahoo.vdslib.state.NodeState) DiskState(com.yahoo.vdslib.state.DiskState)

Aggregations

DiskState (com.yahoo.vdslib.state.DiskState)4 NodeState (com.yahoo.vdslib.state.NodeState)4 Test (org.junit.Test)3 Response (com.yahoo.vespa.clustercontroller.core.restapiv2.Response)1