use of com.yahoo.vdslib.distribution.ConfiguredNode in project vespa by vespa-engine.
the class FleetControllerTest method setUpVdsNodes.
// TODO: Replace all usages of the above setUp methods with this one, and remove the nodes field
/**
* Creates dummy vds nodes for the list of configured nodes and returns them.
* As two dummy nodes are created for each configured node - one distributor and one storage node -
* the returned list is twice as large as configuredNodes.
*/
protected List<DummyVdsNode> setUpVdsNodes(boolean useFakeTimer, DummyVdsNodeOptions options, boolean startDisconnected, List<ConfiguredNode> configuredNodes) throws Exception {
String[] connectionSpecs = new String[1];
connectionSpecs[0] = "tcp/localhost:" + slobrok.port();
nodes = new ArrayList<>();
final boolean distributor = true;
for (ConfiguredNode configuredNode : configuredNodes) {
nodes.add(new DummyVdsNode(useFakeTimer ? timer : new RealTimer(), options, connectionSpecs, this.options.clusterName, distributor, configuredNode.index()));
if (!startDisconnected)
nodes.get(nodes.size() - 1).connect();
nodes.add(new DummyVdsNode(useFakeTimer ? timer : new RealTimer(), options, connectionSpecs, this.options.clusterName, !distributor, configuredNode.index()));
if (!startDisconnected)
nodes.get(nodes.size() - 1).connect();
}
return nodes;
}
use of com.yahoo.vdslib.distribution.ConfiguredNode in project vespa by vespa-engine.
the class NodeStateChangeCheckerTest method createStorageNodeInfo.
private StorageNodeInfo createStorageNodeInfo(int index, State state) {
Distribution distribution = mock(Distribution.class);
Group group = new Group(2, "to");
when(distribution.getRootGroup()).thenReturn(group);
String clusterName = "Clustername";
Set<ConfiguredNode> configuredNodeIndexes = new HashSet<>();
ContentCluster cluster = new ContentCluster(clusterName, configuredNodeIndexes, distribution, minStorageNodesUp, 0.0);
String rpcAddress = "";
StorageNodeInfo storageNodeInfo = new StorageNodeInfo(cluster, index, false, rpcAddress, distribution);
storageNodeInfo.setReportedState(new NodeState(NodeType.STORAGE, state), 3);
return storageNodeInfo;
}
use of com.yahoo.vdslib.distribution.ConfiguredNode in project vespa by vespa-engine.
the class RpcVersionAutoDowngradeTest method setUpFakeCluster.
private void setUpFakeCluster(int nodeRpcVersion) throws Exception {
List<ConfiguredNode> configuredNodes = new ArrayList<>();
for (int i = 0; i < 10; i++) {
configuredNodes.add(new ConfiguredNode(i, false));
}
FleetControllerOptions options = new FleetControllerOptions("mycluster", configuredNodes);
setUpFleetController(false, options);
DummyVdsNodeOptions nodeOptions = new DummyVdsNodeOptions();
nodeOptions.stateCommunicationVersion = nodeRpcVersion;
List<DummyVdsNode> nodes = setUpVdsNodes(false, nodeOptions, true, configuredNodes);
for (DummyVdsNode node : nodes) {
node.setNodeState(new NodeState(node.getType(), State.UP).setMinUsedBits(20));
node.connect();
}
}
use of com.yahoo.vdslib.distribution.ConfiguredNode in project vespa by vespa-engine.
the class StateChangeHandlerTest method startWithStableStateClusterWithNodesUp.
private void startWithStableStateClusterWithNodesUp() {
for (NodeType type : NodeType.getTypes()) {
for (ConfiguredNode i : configuredNodes) {
NodeInfo nodeInfo = cluster.clusterInfo().setRpcAddress(new Node(type, i.index()), null);
nodeInfo.markRpcAddressLive();
nodeStateChangeHandler.handleNewReportedNodeState(currentClusterState(), nodeInfo, new NodeState(type, State.UP), null);
nodeInfo.setReportedState(new NodeState(type, State.UP), clock.getCurrentTimeInMillis());
}
}
for (NodeType type : NodeType.getTypes()) {
for (ConfiguredNode i : configuredNodes) {
Node n = new Node(type, i.index());
assertEquals(State.UP, currentClusterState().getNodeState(n).getState());
}
}
clock.advanceTime(config.stableStateTime);
}
use of com.yahoo.vdslib.distribution.ConfiguredNode in project vespa by vespa-engine.
the class DistributionBuilder method forHierarchicCluster.
public static Distribution forHierarchicCluster(GroupBuilder root) {
List<ConfiguredNode> nodes = buildConfiguredNodes(root.totalNodeCount());
StorDistributionConfig.Builder configBuilder = new StorDistributionConfig.Builder();
configBuilder.redundancy(2);
StorDistributionConfig.Group.Builder rootBuilder = new StorDistributionConfig.Group.Builder();
rootBuilder.name("invalid");
rootBuilder.index("invalid");
rootBuilder.partitions(root.groupDistributionSpec());
configBuilder.group(rootBuilder);
int offset = 0;
for (int group = 0; group < root.groupsWithNodeCount.size(); ++group) {
int nodeCount = root.groupsWithNodeCount.get(group);
StorDistributionConfig.Group.Builder groupBuilder = configuredGroup("group_" + (group + 1), group + 1, nodes.subList(offset, offset + nodeCount));
configBuilder.group(groupBuilder);
offset += nodeCount;
}
return new Distribution(new StorDistributionConfig(configBuilder));
}
Aggregations