use of com.yahoo.vdslib.state.ClusterState in project vespa by vespa-engine.
the class DistributionBitCountTest method testDistributionBitCountConfigIncrease.
/**
* Test that then altering config to increased bit count, that a new system state is sent out if the least split storagenode use more bits.
* Test that then altering config to increased bit count, that a new system state is not sent out (and not altered) if a storagenode needs it to be no further split.
*/
@Test
public void testDistributionBitCountConfigIncrease() throws Exception {
setUpSystem("DistributionBitCountTest::testDistributionBitCountConfigIncrease");
options.distributionBits = 20;
fleetController.updateOptions(options, 0);
ClusterState currentState = waitForState("version:\\d+ bits:20 distributor:10 storage:10");
int version = currentState.getVersion();
options.distributionBits = 23;
fleetController.updateOptions(options, 0);
assertEquals(version, currentState.getVersion());
}
use of com.yahoo.vdslib.state.ClusterState in project vespa by vespa-engine.
the class DummyCommunicator method setSystemState.
@Override
public void setSystemState(ClusterStateBundle stateBundle, NodeInfo node, Waiter<SetClusterStateRequest> waiter) {
ClusterState baselineState = stateBundle.getBaselineClusterState();
DummySetClusterStateRequest req = new DummySetClusterStateRequest(node, baselineState);
node.setSystemStateVersionSent(baselineState);
req.setReply(new SetClusterStateRequest.Reply());
if (node.isStorage() || !shouldDeferDistributorClusterStateAcks) {
waiter.done(req);
} else {
deferredClusterStateAcks.add(new Pair<>(waiter, req));
}
}
use of com.yahoo.vdslib.state.ClusterState in project vespa by vespa-engine.
the class NodeStateChangeCheckerTest method testNodeRatioRequirementConsidersGeneratedNodeStates.
@Test
public void testNodeRatioRequirementConsidersGeneratedNodeStates() {
ContentCluster cluster = createCluster(createNodes(4));
NodeStateChangeChecker nodeStateChangeChecker = createChangeChecker(cluster);
markAllNodesAsReportingStateUp(cluster);
// Both minRatioOfStorageNodesUp and minStorageNodesUp imply that a single node being
// in state Down should halt the upgrade. This must also take into account the generated
// state, not just the reported state. In this case, all nodes are reported as being Up
// but one node has a generated state of Down.
ClusterState stateWithNodeDown = clusterState(String.format("version:%d distributor:4 storage:4 .3.s:d", currentClusterStateVersion));
NodeStateChangeChecker.Result result = nodeStateChangeChecker.evaluateTransition(nodeStorage, stateWithNodeDown, SetUnitStateRequest.Condition.SAFE, UP_NODE_STATE, MAINTENANCE_NODE_STATE);
assertFalse(result.settingWantedStateIsAllowed());
assertFalse(result.wantedStateAlreadySet());
}
use of com.yahoo.vdslib.state.ClusterState 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);
}
use of com.yahoo.vdslib.state.ClusterState in project vespa by vespa-engine.
the class NodeStateChangeCheckerTest method testSetUpSucceedsIfReportedIsUpButGeneratedIsDown.
// A node may be reported as Up but have a generated state of Down if it's part of
// nodes taken down implicitly due to a group having too low node availability.
@Test
public void testSetUpSucceedsIfReportedIsUpButGeneratedIsDown() {
ContentCluster cluster = createCluster(createNodes(4));
NodeStateChangeChecker nodeStateChangeChecker = createChangeChecker(cluster);
markAllNodesAsReportingStateUp(cluster);
ClusterState stateWithNodeDown = clusterState(String.format("version:%d distributor:4 storage:4 .%d.s:d", currentClusterStateVersion, nodeStorage.getIndex()));
NodeStateChangeChecker.Result result = nodeStateChangeChecker.evaluateTransition(nodeStorage, stateWithNodeDown, SetUnitStateRequest.Condition.SAFE, MAINTENANCE_NODE_STATE, UP_NODE_STATE);
assertTrue(result.settingWantedStateIsAllowed());
assertFalse(result.wantedStateAlreadySet());
}
Aggregations