Search in sources :

Example 16 with ClusterState

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

the class DistributionBitCountTest method testDistributionBitCountConfigIncrease.

/**
 * Test that then altering config to increased bit count, that a new system state is sent out if the least split storagenode use more bits.
 * Test that then altering config to increased bit count, that a new system state is not sent out (and not altered) if a storagenode needs it to be no further split.
 */
@Test
public void testDistributionBitCountConfigIncrease() throws Exception {
    setUpSystem("DistributionBitCountTest::testDistributionBitCountConfigIncrease");
    options.distributionBits = 20;
    fleetController.updateOptions(options, 0);
    ClusterState currentState = waitForState("version:\\d+ bits:20 distributor:10 storage:10");
    int version = currentState.getVersion();
    options.distributionBits = 23;
    fleetController.updateOptions(options, 0);
    assertEquals(version, currentState.getVersion());
}
Also used : ClusterState(com.yahoo.vdslib.state.ClusterState) Test(org.junit.Test)

Example 17 with ClusterState

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

the class DummyCommunicator method setSystemState.

@Override
public void setSystemState(ClusterStateBundle stateBundle, NodeInfo node, Waiter<SetClusterStateRequest> waiter) {
    ClusterState baselineState = stateBundle.getBaselineClusterState();
    DummySetClusterStateRequest req = new DummySetClusterStateRequest(node, baselineState);
    node.setSystemStateVersionSent(baselineState);
    req.setReply(new SetClusterStateRequest.Reply());
    if (node.isStorage() || !shouldDeferDistributorClusterStateAcks) {
        waiter.done(req);
    } else {
        deferredClusterStateAcks.add(new Pair<>(waiter, req));
    }
}
Also used : ClusterState(com.yahoo.vdslib.state.ClusterState)

Example 18 with ClusterState

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

the class NodeStateChangeCheckerTest method testNodeRatioRequirementConsidersGeneratedNodeStates.

@Test
public void testNodeRatioRequirementConsidersGeneratedNodeStates() {
    ContentCluster cluster = createCluster(createNodes(4));
    NodeStateChangeChecker nodeStateChangeChecker = createChangeChecker(cluster);
    markAllNodesAsReportingStateUp(cluster);
    // Both minRatioOfStorageNodesUp and minStorageNodesUp imply that a single node being
    // in state Down should halt the upgrade. This must also take into account the generated
    // state, not just the reported state. In this case, all nodes are reported as being Up
    // but one node has a generated state of Down.
    ClusterState stateWithNodeDown = clusterState(String.format("version:%d distributor:4 storage:4 .3.s:d", currentClusterStateVersion));
    NodeStateChangeChecker.Result result = nodeStateChangeChecker.evaluateTransition(nodeStorage, stateWithNodeDown, SetUnitStateRequest.Condition.SAFE, UP_NODE_STATE, MAINTENANCE_NODE_STATE);
    assertFalse(result.settingWantedStateIsAllowed());
    assertFalse(result.wantedStateAlreadySet());
}
Also used : ClusterState(com.yahoo.vdslib.state.ClusterState) Test(org.junit.Test)

Example 19 with ClusterState

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

the class NodeStateChangeCheckerTest method transitionToMaintenanceWithOneStorageNodeDown.

private NodeStateChangeChecker.Result transitionToMaintenanceWithOneStorageNodeDown(int storageNodeIndex, boolean alternatingUpRetiredAndInitializing) {
    ContentCluster cluster = createCluster(createNodes(4));
    NodeStateChangeChecker nodeStateChangeChecker = createChangeChecker(cluster);
    for (int x = 0; x < cluster.clusterInfo().getConfiguredNodes().size(); x++) {
        State state = State.UP;
        // Pick some retired and initializing nodes too
        if (alternatingUpRetiredAndInitializing) {
            // TODO: Move this into the calling test
            if (x % 3 == 1)
                state = State.RETIRED;
            else if (x % 3 == 2)
                state = State.INITIALIZING;
        }
        cluster.clusterInfo().getDistributorNodeInfo(x).setReportedState(new NodeState(NodeType.DISTRIBUTOR, state), 0);
        cluster.clusterInfo().getDistributorNodeInfo(x).setHostInfo(HostInfo.createHostInfo(createDistributorHostInfo(4, 5, 6)));
        cluster.clusterInfo().getStorageNodeInfo(x).setReportedState(new NodeState(NodeType.STORAGE, state), 0);
    }
    ClusterState clusterState = defaultAllUpClusterState();
    if (storageNodeIndex >= 0) {
        // TODO: Move this into the calling test
        NodeState downNodeState = new NodeState(NodeType.STORAGE, State.DOWN);
        cluster.clusterInfo().getStorageNodeInfo(storageNodeIndex).setReportedState(downNodeState, 4);
        clusterState.setNodeState(new Node(NodeType.STORAGE, storageNodeIndex), downNodeState);
    }
    return nodeStateChangeChecker.evaluateTransition(nodeStorage, clusterState, SetUnitStateRequest.Condition.SAFE, UP_NODE_STATE, MAINTENANCE_NODE_STATE);
}
Also used : ClusterState(com.yahoo.vdslib.state.ClusterState) NodeState(com.yahoo.vdslib.state.NodeState) NodeState(com.yahoo.vdslib.state.NodeState) ClusterState(com.yahoo.vdslib.state.ClusterState) State(com.yahoo.vdslib.state.State) Node(com.yahoo.vdslib.state.Node) ConfiguredNode(com.yahoo.vdslib.distribution.ConfiguredNode)

Example 20 with ClusterState

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

the class NodeStateChangeCheckerTest method testSetUpSucceedsIfReportedIsUpButGeneratedIsDown.

// A node may be reported as Up but have a generated state of Down if it's part of
// nodes taken down implicitly due to a group having too low node availability.
@Test
public void testSetUpSucceedsIfReportedIsUpButGeneratedIsDown() {
    ContentCluster cluster = createCluster(createNodes(4));
    NodeStateChangeChecker nodeStateChangeChecker = createChangeChecker(cluster);
    markAllNodesAsReportingStateUp(cluster);
    ClusterState stateWithNodeDown = clusterState(String.format("version:%d distributor:4 storage:4 .%d.s:d", currentClusterStateVersion, nodeStorage.getIndex()));
    NodeStateChangeChecker.Result result = nodeStateChangeChecker.evaluateTransition(nodeStorage, stateWithNodeDown, SetUnitStateRequest.Condition.SAFE, MAINTENANCE_NODE_STATE, UP_NODE_STATE);
    assertTrue(result.settingWantedStateIsAllowed());
    assertFalse(result.wantedStateAlreadySet());
}
Also used : ClusterState(com.yahoo.vdslib.state.ClusterState) Test(org.junit.Test)

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