Search in sources :

Example 6 with Distribution

use of com.yahoo.vdslib.distribution.Distribution in project vespa by vespa-engine.

the class StatusPagesTest method testNodePage.

@Test
public void testNodePage() throws Exception {
    startingTest("StatusPagesTest::testNodePage()");
    FleetControllerOptions options = new FleetControllerOptions("mycluster");
    options.setStorageDistribution(new Distribution(Distribution.getDefaultDistributionConfig(3, 10)));
    setUpFleetController(true, options);
    setUpVdsNodes(true, new DummyVdsNodeOptions());
    waitForStableSystem();
    String content = doHttpGetRequest("/node=storage.0");
    assertTrue(content, content.contains("<html>"));
    assertTrue(content, content.contains("</html>"));
    assertTrue(content, content.contains("Node status for storage.0"));
    assertTrue(content, content.contains("REPORTED"));
    assertTrue(content, content.contains("Altered node state in cluster state from"));
// System.err.println(sb.toString());
}
Also used : Distribution(com.yahoo.vdslib.distribution.Distribution) Test(org.junit.Test)

Example 7 with Distribution

use of com.yahoo.vdslib.distribution.Distribution in project vespa by vespa-engine.

the class StateRestApiTest method setUp.

protected void setUp(boolean dontInitializeNode2) throws Exception {
    Distribution distribution = new Distribution(Distribution.getSimpleGroupConfig(2, 10));
    jsonWriter.setDefaultPathPrefix("/cluster/v2");
    {
        Set<ConfiguredNode> nodes = FleetControllerTest.toNodes(0, 1, 2, 3);
        ContentCluster cluster = new ContentCluster("books", nodes, distribution, 6, /* minStorageNodesUp*/
        0.9);
        initializeCluster(cluster, nodes);
        AnnotatedClusterState baselineState = AnnotatedClusterState.withoutAnnotations(ClusterState.stateFromString("distributor:4 storage:4"));
        Map<String, AnnotatedClusterState> bucketSpaceStates = new HashMap<>();
        bucketSpaceStates.put("default", AnnotatedClusterState.withoutAnnotations(ClusterState.stateFromString("distributor:4 storage:4 .3.s:m")));
        bucketSpaceStates.put("global", baselineState);
        books = new ClusterControllerMock(cluster, baselineState.getClusterState(), ClusterStateBundle.of(baselineState, bucketSpaceStates), 0, 0);
    }
    {
        Set<ConfiguredNode> nodes = FleetControllerTest.toNodes(1, 2, 3, 5, 7);
        Set<ConfiguredNode> nodesInSlobrok = FleetControllerTest.toNodes(1, 3, 5, 7);
        ContentCluster cluster = new ContentCluster("music", nodes, distribution, 4, /* minStorageNodesUp*/
        0.0);
        if (dontInitializeNode2) {
            // TODO: this skips initialization of node 2 to fake that it is not answering
            // which really leaves us in an illegal state
            initializeCluster(cluster, nodesInSlobrok);
        } else {
            initializeCluster(cluster, nodes);
        }
        AnnotatedClusterState baselineState = AnnotatedClusterState.withoutAnnotations(ClusterState.stateFromString("distributor:8 .0.s:d .2.s:d .4.s:d .6.s:d " + "storage:8 .0.s:d .2.s:d .4.s:d .6.s:d"));
        music = new ClusterControllerMock(cluster, baselineState.getClusterState(), ClusterStateBundle.ofBaselineOnly(baselineState), 0, 0);
    }
    ccSockets = new TreeMap<>();
    ccSockets.put(0, new ClusterControllerStateRestAPI.Socket("localhost", 80));
    restAPI = new ClusterControllerStateRestAPI(new ClusterControllerStateRestAPI.FleetControllerResolver() {

        @Override
        public Map<String, RemoteClusterControllerTaskScheduler> getFleetControllers() {
            Map<String, RemoteClusterControllerTaskScheduler> fleetControllers = new LinkedHashMap<>();
            fleetControllers.put(books.context.cluster.getName(), books);
            fleetControllers.put(music.context.cluster.getName(), music);
            return fleetControllers;
        }
    }, ccSockets);
}
Also used : Distribution(com.yahoo.vdslib.distribution.Distribution)

Example 8 with Distribution

use of com.yahoo.vdslib.distribution.Distribution in project vespa by vespa-engine.

the class DistributionBuilder method forFlatCluster.

public static Distribution forFlatCluster(int nodeCount) {
    Collection<ConfiguredNode> nodes = buildConfiguredNodes(nodeCount);
    StorDistributionConfig.Builder configBuilder = new StorDistributionConfig.Builder();
    configBuilder.redundancy(2);
    configBuilder.group(configuredGroup("bar", 0, nodes));
    return new Distribution(new StorDistributionConfig(configBuilder));
}
Also used : StorDistributionConfig(com.yahoo.vespa.config.content.StorDistributionConfig) ConfiguredNode(com.yahoo.vdslib.distribution.ConfiguredNode) Distribution(com.yahoo.vdslib.distribution.Distribution)

Example 9 with Distribution

use of com.yahoo.vdslib.distribution.Distribution 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 10 with Distribution

use of com.yahoo.vdslib.distribution.Distribution 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)

Aggregations

Distribution (com.yahoo.vdslib.distribution.Distribution)15 ConfiguredNode (com.yahoo.vdslib.distribution.ConfiguredNode)7 Test (org.junit.Test)7 Request (com.yahoo.jrt.Request)3 Spec (com.yahoo.jrt.Spec)3 Supervisor (com.yahoo.jrt.Supervisor)3 Target (com.yahoo.jrt.Target)3 Transport (com.yahoo.jrt.Transport)3 StringValue (com.yahoo.jrt.StringValue)2 Group (com.yahoo.vdslib.distribution.Group)2 Node (com.yahoo.vdslib.state.Node)2 NodeState (com.yahoo.vdslib.state.NodeState)2 StorDistributionConfig (com.yahoo.vespa.config.content.StorDistributionConfig)2 ClusterState (com.yahoo.vdslib.state.ClusterState)1 StatusHandler (com.yahoo.vespa.clustercontroller.core.status.StatusHandler)1 HttpRequest (com.yahoo.vespa.clustercontroller.utils.communication.http.HttpRequest)1 HttpResult (com.yahoo.vespa.clustercontroller.utils.communication.http.HttpResult)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1