Search in sources :

Example 1 with Group

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);
}
Also used : Group(com.yahoo.vdslib.distribution.Group) VdsClusterHtmlRendrer(com.yahoo.vespa.clustercontroller.core.status.statuspage.VdsClusterHtmlRendrer) ConfiguredNode(com.yahoo.vdslib.distribution.ConfiguredNode)

Example 2 with Group

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;
}
Also used : Group(com.yahoo.vdslib.distribution.Group) NodeState(com.yahoo.vdslib.state.NodeState) Distribution(com.yahoo.vdslib.distribution.Distribution) ConfiguredNode(com.yahoo.vdslib.distribution.ConfiguredNode) StringContains.containsString(org.hamcrest.core.StringContains.containsString) HashSet(java.util.HashSet)

Example 3 with Group

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);
}
Also used : Group(com.yahoo.vdslib.distribution.Group) Distribution(com.yahoo.vdslib.distribution.Distribution)

Example 4 with Group

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"));
}
Also used : Group(com.yahoo.vdslib.distribution.Group) Test(org.junit.Test)

Example 5 with Group

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"));
}
Also used : Group(com.yahoo.vdslib.distribution.Group) Test(org.junit.Test)

Aggregations

Group (com.yahoo.vdslib.distribution.Group)8 Test (org.junit.Test)4 ConfiguredNode (com.yahoo.vdslib.distribution.ConfiguredNode)2 Distribution (com.yahoo.vdslib.distribution.Distribution)2 NodeState (com.yahoo.vdslib.state.NodeState)1 VdsClusterHtmlRendrer (com.yahoo.vespa.clustercontroller.core.status.statuspage.VdsClusterHtmlRendrer)1 HashSet (java.util.HashSet)1 StringContains.containsString (org.hamcrest.core.StringContains.containsString)1