use of com.yahoo.vdslib.state.Node in project vespa by vespa-engine.
the class ClusterStateGeneratorTest method do_test_storage_node_with_no_init_progress.
private String do_test_storage_node_with_no_init_progress(State wantedState) {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(3).bringEntireClusterUp().reportStorageNodeState(0, new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.5)).proposeStorageNodeWantedState(0, wantedState);
final NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 0));
nodeInfo.setInitProgressTime(10_000);
final ClusterStateGenerator.Params params = fixture.generatorParams().maxInitProgressTime(1000).currentTimeInMilllis(11_000);
final AnnotatedClusterState state = ClusterStateGenerator.generatedStateFrom(params);
return state.toString();
}
use of com.yahoo.vdslib.state.Node in project vespa by vespa-engine.
the class ClusterStateGeneratorTest method configured_zero_init_progress_time_disables_auto_init_to_down_feature.
@Test
public void configured_zero_init_progress_time_disables_auto_init_to_down_feature() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(3).bringEntireClusterUp().reportStorageNodeState(0, new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.5));
final NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 0));
nodeInfo.setInitProgressTime(10_000);
final ClusterStateGenerator.Params params = fixture.generatorParams().maxInitProgressTime(0).currentTimeInMilllis(11_000);
final AnnotatedClusterState state = ClusterStateGenerator.generatedStateFrom(params);
assertThat(state.toString(), equalTo("distributor:3 storage:3 .0.s:i .0.i:0.5"));
}
use of com.yahoo.vdslib.state.Node in project vespa by vespa-engine.
the class SlobrokClient method getSlobrokData.
private Map<Node, SlobrokData> getSlobrokData(String pattern) {
Map<Node, SlobrokData> result = new TreeMap<>();
Mirror.Entry[] entries = mirror.lookup(pattern);
log.log(LogLevel.SPAM, "Looking for slobrok entries with pattern '" + pattern + "'. Found " + entries.length + " entries.");
for (Mirror.Entry entry : entries) {
StringTokenizer st = new StringTokenizer(entry.getName(), "/");
String addressType = st.nextToken();
// skip
String cluster = st.nextToken();
NodeType nodeType = NodeType.get(st.nextToken());
Integer nodeIndex = Integer.valueOf(st.nextToken());
// skip
String service = (st.hasMoreTokens() ? st.nextToken() : "");
assert (addressType.equals("storage"));
Node n = new Node(nodeType, nodeIndex);
result.put(n, new SlobrokData(n, entry.getSpec()));
}
return result;
}
use of com.yahoo.vdslib.state.Node in project vespa by vespa-engine.
the class EventLogTest method testNoEventsDoNotThrowException.
@Test
public void testNoEventsDoNotThrowException() {
initialize(metricUpdater);
StringBuilder builder = new StringBuilder();
Node nonExistantNode = new Node(NodeType.DISTRIBUTOR, 0);
eventLog.writeHtmlState(builder, nonExistantNode);
assertNotEquals("", builder.toString());
}
use of com.yahoo.vdslib.state.Node in project vespa by vespa-engine.
the class FleetControllerTest method waitForNodeStateReported.
protected void waitForNodeStateReported(int nodeIndex, NodeState state, int ms) {
long timeoutAtTime = System.currentTimeMillis() + ms;
while (true) {
Node node = nodes.get(nodeIndex).getNode();
NodeState ns = fleetController.getReportedNodeState(node);
if ((ns == null && state == null) || (ns != null && state != null && ns.equals(state)))
break;
if (System.currentTimeMillis() > timeoutAtTime) {
throw new IllegalStateException("Failed to find " + node + " in nodestate " + state + " before timeout of " + ms + " milliseconds.");
}
}
}
Aggregations