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());
}
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);
}
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));
}
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;
}
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);
}
Aggregations