Search in sources :

Example 56 with NodeState

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

the class ClusterStateGeneratorTest method non_observed_distributor_start_timestamp_is_included_in_state.

@Test
public void non_observed_distributor_start_timestamp_is_included_in_state() {
    final NodeState nodeState = new NodeState(NodeType.DISTRIBUTOR, State.UP);
    nodeState.setStartTimestamp(6000);
    final ClusterFixture fixture = ClusterFixture.forFlatCluster(5).bringEntireClusterUp().reportDistributorNodeState(1, nodeState);
    final AnnotatedClusterState state = generateFromFixtureWithDefaultParams(fixture);
    assertThat(state.toString(), equalTo("distributor:5 .1.t:6000 storage:5"));
}
Also used : NodeState(com.yahoo.vdslib.state.NodeState) Test(org.junit.Test)

Example 57 with NodeState

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

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

the class RPCCommunicator method getNodeState.

@Override
public void getNodeState(NodeInfo node, Waiter<GetNodeStateRequest> externalWaiter) {
    Target connection = getConnection(node);
    if (!connection.isValid()) {
        log.log(LogLevel.DEBUG, "Connection to " + node.getRpcAddress() + " could not be created.");
    }
    // TODO remove this deprecated legacy stuff
    if (node.getVersion() == 0 && node.getConnectionVersion() > 0) {
        doVersion0HandShake(connection, node);
        clearOldStoredNodeState(connection, node);
    }
    NodeState currentState = node.getReportedState();
    Request req;
    if (node.getVersion() == 0) {
        req = new Request("getnodestate");
    } else {
        req = new Request(node.getVersion() == 1 ? "getnodestate2" : "getnodestate3");
        req.parameters().add(new StringValue(currentState.getState().equals(State.DOWN) || node.getConnectionAttemptCount() > 0 ? "unknown" : currentState.serialize()));
        req.parameters().add(new Int32Value(generateNodeStateRequestTimeoutMs()));
        if (node.getVersion() > 1) {
            req.parameters().add(new Int32Value(fleetControllerIndex));
        }
    }
    RPCGetNodeStateRequest stateRequest = new RPCGetNodeStateRequest(node, req);
    RPCGetNodeStateWaiter waiter = new RPCGetNodeStateWaiter(stateRequest, externalWaiter, timer);
    double requestTimeoutSeconds = nodeStateRequestTimeoutIntervalMaxSeconds + nodeStateRequestRoundTripTimeMaxSeconds;
    connection.invokeAsync(req, requestTimeoutSeconds, waiter);
    node.setCurrentNodeStateRequest(stateRequest, timer.getCurrentTimeInMillis());
    node.lastRequestInfoConnection = connection;
}
Also used : NodeState(com.yahoo.vdslib.state.NodeState)

Example 59 with NodeState

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

the class ClusterFixture method reportDistributorNodeState.

public ClusterFixture reportDistributorNodeState(final int index, State state) {
    final Node node = new Node(NodeType.DISTRIBUTOR, index);
    final NodeState nodeState = new NodeState(NodeType.DISTRIBUTOR, state);
    doReportNodeState(node, nodeState);
    return this;
}
Also used : NodeState(com.yahoo.vdslib.state.NodeState) ConfiguredNode(com.yahoo.vdslib.distribution.ConfiguredNode) Node(com.yahoo.vdslib.state.Node)

Example 60 with NodeState

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

the class ClusterFixture method proposeStorageNodeWantedState.

public ClusterFixture proposeStorageNodeWantedState(final int index, State state, String description) {
    final Node node = new Node(NodeType.STORAGE, index);
    final NodeState nodeState = new NodeState(NodeType.STORAGE, state);
    doProposeWantedState(node, nodeState, description);
    return this;
}
Also used : NodeState(com.yahoo.vdslib.state.NodeState) ConfiguredNode(com.yahoo.vdslib.distribution.ConfiguredNode) Node(com.yahoo.vdslib.state.Node)

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