use of com.yahoo.vdslib.state.NodeState in project vespa by vespa-engine.
the class FleetControllerTest method setWantedState.
protected void setWantedState(DummyVdsNode node, State state, String reason) {
if (supervisor == null) {
supervisor = new Supervisor(new Transport());
}
NodeState ns = new NodeState(node.getType(), state);
if (reason != null)
ns.setDescription(reason);
Target connection = supervisor.connect(new Spec("localhost", fleetController.getRpcPort()));
Request req = new Request("setNodeState");
req.parameters().add(new StringValue(node.getSlobrokName()));
req.parameters().add(new StringValue(ns.serialize()));
connection.invokeSync(req, timeoutS);
if (req.isError()) {
assertTrue("Failed to invoke setNodeState(): " + req.errorCode() + ": " + req.errorMessage(), false);
}
if (!req.checkReturnTypes("s")) {
assertTrue("Failed to invoke setNodeState(): Invalid return types.", false);
}
}
use of com.yahoo.vdslib.state.NodeState in project vespa by vespa-engine.
the class GroupAutoTakedownTest method init_progress_is_preserved_across_group_down_up_edge.
@Test
public void init_progress_is_preserved_across_group_down_up_edge() {
ClusterFixture fixture = createFixtureForAllUpHierarchicCluster(DistributionBuilder.withGroups(3).eachWithNodeCount(2), 0.51);
final NodeState newState = new NodeState(NodeType.STORAGE, State.INITIALIZING);
newState.setInitProgress(0.5);
fixture.reportStorageNodeState(4, newState);
assertEquals("distributor:6 storage:6 .4.s:i .4.i:0.5", fixture.generatedClusterState());
assertEquals("distributor:6 storage:4", stateAfterStorageTransition(fixture, 5, State.DOWN));
assertEquals("distributor:6 storage:6 .4.s:i .4.i:0.5", stateAfterStorageTransition(fixture, 5, State.UP));
}
use of com.yahoo.vdslib.state.NodeState in project vespa by vespa-engine.
the class NodeStateChangeCheckerTest method testMissingDistributorState.
@Test
public void testMissingDistributorState() {
ContentCluster cluster = createCluster(createNodes(4));
NodeStateChangeChecker nodeStateChangeChecker = createChangeChecker(cluster);
cluster.clusterInfo().getStorageNodeInfo(1).setReportedState(new NodeState(NodeType.STORAGE, State.UP), 0);
NodeStateChangeChecker.Result result = nodeStateChangeChecker.evaluateTransition(nodeStorage, defaultAllUpClusterState(), SetUnitStateRequest.Condition.SAFE, UP_NODE_STATE, MAINTENANCE_NODE_STATE);
assertFalse(result.settingWantedStateIsAllowed());
assertFalse(result.wantedStateAlreadySet());
assertThat(result.getReason(), is("Distributor node (0) has not reported any cluster state version yet."));
}
use of com.yahoo.vdslib.state.NodeState in project vespa by vespa-engine.
the class NodeStateChangeCheckerTest method setAllNodesUp.
private void setAllNodesUp(ContentCluster cluster, HostInfo distributorHostInfo) {
for (int x = 0; x < cluster.clusterInfo().getConfiguredNodes().size(); x++) {
State state = State.UP;
cluster.clusterInfo().getDistributorNodeInfo(x).setReportedState(new NodeState(NodeType.DISTRIBUTOR, state), 0);
cluster.clusterInfo().getDistributorNodeInfo(x).setHostInfo(distributorHostInfo);
cluster.clusterInfo().getStorageNodeInfo(x).setReportedState(new NodeState(NodeType.STORAGE, state), 0);
}
}
use of com.yahoo.vdslib.state.NodeState in project vespa by vespa-engine.
the class NodeStateChangeCheckerTest method transitionToMaintenanceWithOneStorageNodeDown.
private NodeStateChangeChecker.Result transitionToMaintenanceWithOneStorageNodeDown(int storageNodeIndex, boolean alternatingUpRetiredAndInitializing) {
ContentCluster cluster = createCluster(createNodes(4));
NodeStateChangeChecker nodeStateChangeChecker = createChangeChecker(cluster);
for (int x = 0; x < cluster.clusterInfo().getConfiguredNodes().size(); x++) {
State state = State.UP;
// Pick some retired and initializing nodes too
if (alternatingUpRetiredAndInitializing) {
// TODO: Move this into the calling test
if (x % 3 == 1)
state = State.RETIRED;
else if (x % 3 == 2)
state = State.INITIALIZING;
}
cluster.clusterInfo().getDistributorNodeInfo(x).setReportedState(new NodeState(NodeType.DISTRIBUTOR, state), 0);
cluster.clusterInfo().getDistributorNodeInfo(x).setHostInfo(HostInfo.createHostInfo(createDistributorHostInfo(4, 5, 6)));
cluster.clusterInfo().getStorageNodeInfo(x).setReportedState(new NodeState(NodeType.STORAGE, state), 0);
}
ClusterState clusterState = defaultAllUpClusterState();
if (storageNodeIndex >= 0) {
// TODO: Move this into the calling test
NodeState downNodeState = new NodeState(NodeType.STORAGE, State.DOWN);
cluster.clusterInfo().getStorageNodeInfo(storageNodeIndex).setReportedState(downNodeState, 4);
clusterState.setNodeState(new Node(NodeType.STORAGE, storageNodeIndex), downNodeState);
}
return nodeStateChangeChecker.evaluateTransition(nodeStorage, clusterState, SetUnitStateRequest.Condition.SAFE, UP_NODE_STATE, MAINTENANCE_NODE_STATE);
}
Aggregations