use of com.yahoo.vdslib.state.Node in project vespa by vespa-engine.
the class ClusterStateGeneratorTest method reported_node_down_after_transition_time_has_down_generated_state.
@Test
public void reported_node_down_after_transition_time_has_down_generated_state() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(5).bringEntireClusterUp();
final ClusterStateGenerator.Params params = fixture.generatorParams().currentTimeInMilllis(11_000).transitionTimes(2000);
fixture.reportStorageNodeState(1, State.DOWN);
final NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 1));
nodeInfo.setTransitionTime(9000);
final AnnotatedClusterState state = ClusterStateGenerator.generatedStateFrom(params);
assertThat(state.toString(), equalTo("distributor:5 storage:5 .1.s:d"));
}
use of com.yahoo.vdslib.state.Node in project vespa by vespa-engine.
the class ClusterStateGeneratorTest method unstable_retired_node_should_be_marked_down.
/**
* The generated state must be considered over the Reported state when deciding whether
* to override it with the Wanted state. Otherwise, an unstable retired node could have
* its generated state be Retired instead of Down. We want it to stay down instead of
* potentially contributing additional instability to the cluster.
*/
@Test
public void unstable_retired_node_should_be_marked_down() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(5).bringEntireClusterUp().proposeStorageNodeWantedState(3, State.RETIRED);
final ClusterStateGenerator.Params params = fixture.generatorParams().maxPrematureCrashes(10);
final NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 3));
nodeInfo.setPrematureCrashCount(11);
final AnnotatedClusterState state = ClusterStateGenerator.generatedStateFrom(params);
assertThat(state.toString(), equalTo("distributor:5 storage:5 .3.s:d"));
}
use of com.yahoo.vdslib.state.Node in project vespa by vespa-engine.
the class ZooKeeperDatabase method storeStartTimestamps.
@Override
public boolean storeStartTimestamps(Map<Node, Long> timestamps) throws InterruptedException {
if (timestamps == null)
timestamps = new TreeMap<>();
StringBuilder sb = new StringBuilder();
for (Node n : timestamps.keySet()) {
Long timestamp = timestamps.get(n);
sb.append(n.toString()).append(':').append(timestamp).append('\n');
}
byte[] val = sb.toString().getBytes(utf8);
try {
log.log(LogLevel.DEBUG, "Fleetcontroller " + nodeIndex + ": Storing start timestamps at '" + zooKeeperRoot + "starttimestamps");
session.setData(zooKeeperRoot + "starttimestamps", val, -1);
return true;
} catch (InterruptedException e) {
throw (InterruptedException) new InterruptedException("Interrupted").initCause(e);
} catch (Exception e) {
if (sessionOpen && reportErrors) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
log.log(LogLevel.WARNING, "Fleetcontroller " + nodeIndex + ": Failed to store start timestamps in zookeeper: " + e.getMessage() + "\n" + sw);
}
return false;
}
}
use of com.yahoo.vdslib.state.Node 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.Node 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