use of com.yahoo.vdslib.state.Node in project vespa by vespa-engine.
the class ClusterFixture method proposeDistributorWantedState.
public ClusterFixture proposeDistributorWantedState(final int index, State state) {
final ClusterState stateBefore = rawGeneratedClusterState();
final Node node = new Node(NodeType.DISTRIBUTOR, index);
final NodeState nodeState = new NodeState(NodeType.DISTRIBUTOR, state);
nodeState.setDescription("mockdesc");
NodeInfo nodeInfo = cluster.getNodeInfo(node);
nodeInfo.setWantedState(nodeState);
nodeStateChangeHandler.proposeNewNodeState(stateBefore, nodeInfo, nodeState);
return this;
}
use of com.yahoo.vdslib.state.Node in project vespa by vespa-engine.
the class LegacyNodePageRequestHandler method handle.
@Override
public StatusPageResponse handle(StatusPageServer.HttpRequest request) {
Matcher m = nodePattern.matcher(request.getPath());
if (!m.matches()) {
throw new IllegalStateException("Node request handler invoked but failed to match path");
}
TimeZone tz = TimeZone.getTimeZone("UTC");
long currentTime = timer.getCurrentTimeInMillis();
NodeType nodeType = NodeType.get(m.group(1));
int index = Integer.valueOf(m.group(2));
Node node = new Node(nodeType, index);
StatusPageResponse response = new StatusPageResponse();
response.setContentType("text/html");
StringBuilder content = new StringBuilder();
content.append("<!-- Answer to request " + request + " -->\n");
response.writeHtmlHeader(content, "Cluster Controller Status Page - Node status for " + node);
content.append("<p>UTC time when creating this page: ").append(RealTimer.printDateNoMilliSeconds(currentTime, tz)).append("</p>");
content.append("[ <a href=\"..\">Back to cluster overview</a> ] <br><br>");
eventLog.writeHtmlState(content, node);
NodeInfo nodeInfo = cluster.getNodeInfo(node);
content.append("<h2>Host info</h2>\n");
if (nodeInfo.getHostInfo() != null) {
content.append("<pre>\n").append(nodeInfo.getHostInfo().getRawCreationString()).append("\n</pre>\n");
} else {
content.append("Not retrieved\n");
}
response.writeHtmlFooter(content, "");
response.writeContent(content.toString());
return response;
}
use of com.yahoo.vdslib.state.Node in project vespa by vespa-engine.
the class EventDiffCalculator method emitPerNodeDiffEvents.
private static void emitPerNodeDiffEvents(final PerStateParams params, final List<Event> events) {
final ContentCluster cluster = params.cluster;
final ClusterState fromState = params.fromState.getClusterState();
final ClusterState toState = params.toState.getClusterState();
for (ConfiguredNode node : cluster.getConfiguredNodes().values()) {
for (NodeType nodeType : NodeType.getTypes()) {
final Node n = new Node(nodeType, node.index());
emitSingleNodeEvents(params, events, cluster, fromState, toState, n);
}
}
}
use of com.yahoo.vdslib.state.Node in project vespa by vespa-engine.
the class RpcServerTest method setWantedNodeState.
private void setWantedNodeState(State newState, NodeType nodeType, int nodeIndex) {
int rpcPort = fleetController.getRpcPort();
if (supervisor == null) {
supervisor = new Supervisor(new Transport());
}
Target connection = supervisor.connect(new Spec("localhost", rpcPort));
assertTrue(connection.isValid());
Node node = new Node(nodeType, nodeIndex);
NodeState newNodeState = new NodeState(nodeType, newState);
Request req = new Request("setNodeState");
req.parameters().add(new StringValue("storage/cluster.mycluster/" + node.getType().toString() + "/" + node.getIndex()));
req.parameters().add(new StringValue(newNodeState.serialize(true)));
connection.invokeSync(req, timeoutS);
assertEquals(req.toString(), ErrorCode.NONE, req.errorCode());
assertTrue(req.toString(), req.checkReturnTypes("s"));
}
use of com.yahoo.vdslib.state.Node in project vespa by vespa-engine.
the class StateVersionTrackerTest method per_node_min_bits_changes_are_not_considered_different.
// For similarity purposes, only the cluster-wide bits matter, not the individual node state
// min used bits. The former is derived from the latter, but the latter is not visible in the
// published state (but _is_ visible in the internal ClusterState structures).
@Test
public void per_node_min_bits_changes_are_not_considered_different() {
final StateVersionTracker versionTracker = createWithMockedMetrics();
final AnnotatedClusterState stateWithMinBits = stateWithoutAnnotations("distributor:2 storage:2");
stateWithMinBits.getClusterState().setNodeState(new Node(NodeType.STORAGE, 0), new NodeState(NodeType.STORAGE, State.UP).setMinUsedBits(15));
updateAndPromote(versionTracker, stateWithMinBits, 123);
versionTracker.updateLatestCandidateStateBundle(stateBundleWithoutAnnotations("distributor:2 storage:2"));
assertFalse(versionTracker.candidateChangedEnoughFromCurrentToWarrantPublish());
}
Aggregations