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"));
}
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"));
}
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;
}
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;
}
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;
}
Aggregations