use of com.yahoo.vdslib.distribution.Group in project vespa by vespa-engine.
the class ContentCluster method writeHtmlState.
public void writeHtmlState(final VdsClusterHtmlRendrer vdsClusterHtmlRendrer, final StringBuilder sb, final Timer timer, final ClusterState state, final ClusterStatsAggregator statsAggregator, final Distribution distribution, final FleetControllerOptions options, final EventLog eventLog) {
final VdsClusterHtmlRendrer.Table table = vdsClusterHtmlRendrer.createNewClusterHtmlTable(clusterName, slobrokGenerationCount);
final List<Group> groups = LeafGroups.enumerateFrom(distribution.getRootGroup());
for (int j = 0; j < groups.size(); ++j) {
final Group group = groups.get(j);
assert (group != null);
final String localName = group.getUnixStylePath();
assert (localName != null);
final TreeMap<Integer, NodeInfo> storageNodeInfoByIndex = new TreeMap<>();
final TreeMap<Integer, NodeInfo> distributorNodeInfoByIndex = new TreeMap<>();
for (ConfiguredNode configuredNode : group.getNodes()) {
storeNodeInfo(configuredNode.index(), NodeType.STORAGE, storageNodeInfoByIndex);
storeNodeInfo(configuredNode.index(), NodeType.DISTRIBUTOR, distributorNodeInfoByIndex);
}
table.renderNodes(storageNodeInfoByIndex, distributorNodeInfoByIndex, timer, state, statsAggregator, options.minMergeCompletionRatio, options.maxPrematureCrashes, eventLog, clusterName, localName);
}
table.addTable(sb, options.stableStateTimePeriod);
}
use of com.yahoo.vdslib.distribution.Group 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.Group in project vespa by vespa-engine.
the class NodeStateChangeCheckerTest method createCluster.
private ContentCluster createCluster(Collection<ConfiguredNode> nodes) {
Distribution distribution = mock(Distribution.class);
Group group = new Group(2, "to");
when(distribution.getRootGroup()).thenReturn(group);
return new ContentCluster("Clustername", nodes, distribution, minStorageNodesUp, 0.0);
}
use of com.yahoo.vdslib.distribution.Group in project vespa by vespa-engine.
the class LeafGroupsTest method rootGroupCountedAsLeafWhenNoChildren.
@Test
public void rootGroupCountedAsLeafWhenNoChildren() {
Group g = new Group(0, "donkeykong");
List<Group> leaves = LeafGroups.enumerateFrom(g);
assertThat(leaves.size(), is(1));
assertThat(leaves.get(0).getName(), is("donkeykong"));
}
use of com.yahoo.vdslib.distribution.Group in project vespa by vespa-engine.
the class LeafGroupsTest method multipleLeafGroupsAreEnumerated.
@Test
public void multipleLeafGroupsAreEnumerated() throws Exception {
Group g = new Group(0, "donkeykong", dummyDistribution());
Group child = new Group(1, "mario", dummyDistribution());
child.addSubGroup(new Group(2, "toad"));
child.addSubGroup(new Group(3, "yoshi"));
g.addSubGroup(child);
g.addSubGroup(new Group(4, "luigi"));
List<Group> leaves = LeafGroups.enumerateFrom(g);
// Ensure that output order matches insertion order.
leaves.sort((a, b) -> Integer.compare(a.getIndex(), b.getIndex()));
assertThat(leaves.size(), is(3));
assertThat(leaves.get(0).getName(), is("toad"));
assertThat(leaves.get(1).getName(), is("yoshi"));
assertThat(leaves.get(2).getName(), is("luigi"));
}
Aggregations