use of com.yahoo.vdslib.distribution.Distribution 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));
}
use of com.yahoo.vdslib.distribution.Distribution in project vespa by vespa-engine.
the class RpcServerTest method testSetNodeState.
@Test
public void testSetNodeState() throws Exception {
startingTest("RpcServerTest::testSetNodeState");
FleetControllerOptions options = new FleetControllerOptions("mycluster");
Set<Integer> nodeIndexes = new TreeSet<>(Arrays.asList(new Integer[] { 4, 6, 9, 10, 14, 16, 21, 22, 23, 25 }));
options.setStorageDistribution(new Distribution(getDistConfig(nodeIndexes)));
setUpFleetController(true, options);
setUpVdsNodes(true, new DummyVdsNodeOptions(), false, nodeIndexes);
waitForState("version:\\d+ distributor:26 .0.s:d .1.s:d .2.s:d .3.s:d .5.s:d .7.s:d .8.s:d .11.s:d .12.s:d .13.s:d .15.s:d .17.s:d .18.s:d .19.s:d .20.s:d .24.s:d storage:26 .0.s:d .1.s:d .2.s:d .3.s:d .5.s:d .7.s:d .8.s:d .11.s:d .12.s:d .13.s:d .15.s:d .17.s:d .18.s:d .19.s:d .20.s:d .24.s:d");
int rpcPort = fleetController.getRpcPort();
supervisor = new Supervisor(new Transport());
Target connection = supervisor.connect(new Spec("localhost", rpcPort));
assertTrue(connection.isValid());
Request req = new Request("setNodeState");
req.parameters().add(new StringValue("storage/cluster.mycluster/storage/14"));
req.parameters().add(new StringValue("s:r"));
connection.invokeSync(req, timeoutS);
assertEquals(req.toString(), ErrorCode.NONE, req.errorCode());
assertTrue(req.toString(), req.checkReturnTypes("s"));
waitForState("version:\\d+ distributor:26 .* storage:26 .* .14.s:r .*");
req = new Request("setNodeState");
req.parameters().add(new StringValue("storage/cluster.mycluster/storage/16"));
req.parameters().add(new StringValue("s:m"));
connection.invokeSync(req, timeoutS);
assertEquals(req.toString(), ErrorCode.NONE, req.errorCode());
assertTrue(req.toString(), req.checkReturnTypes("s"));
ClusterState state = waitForState("version:\\d+ distributor:26 .* storage:26 .* .14.s:r.* .16.s:m .*");
nodes.get(5 * 2 + 1).disconnect();
waitForCompleteCycle();
timer.advanceTime(100000000);
waitForCompleteCycle();
assertEquals(State.MAINTENANCE, fleetController.getSystemState().getNodeState(new Node(NodeType.STORAGE, 16)).getState());
nodes.get(4 * 2 + 1).disconnect();
waitForState("version:\\d+ distributor:26 .* storage:26 .* .14.s:m.* .16.s:m .*");
nodes.get(4 * 2 + 1).connect();
timer.advanceTime(100000000);
// Might need to pass more actual time while waiting below?
waitForState("version:\\d+ distributor:26 .* storage:26 .* .14.s:r.* .16.s:m .*");
}
use of com.yahoo.vdslib.distribution.Distribution in project vespa by vespa-engine.
the class RpcServerTest method testSetNodeStateOutOfRange.
@Test
public void testSetNodeStateOutOfRange() throws Exception {
startingTest("RpcServerTest::testSetNodeStateOutOfRange");
FleetControllerOptions options = new FleetControllerOptions("mycluster");
options.setStorageDistribution(new Distribution(Distribution.getDefaultDistributionConfig(2, 10)));
setUpFleetController(true, options);
setUpVdsNodes(true, new DummyVdsNodeOptions());
waitForStableSystem();
int rpcPort = fleetController.getRpcPort();
supervisor = new Supervisor(new Transport());
Target connection = supervisor.connect(new Spec("localhost", rpcPort));
assertTrue(connection.isValid());
Request req = new Request("setNodeState");
req.parameters().add(new StringValue("storage/cluster.mycluster/storage/10"));
req.parameters().add(new StringValue("s:m"));
connection.invokeSync(req, timeoutS);
assertEquals(req.toString(), ErrorCode.METHOD_FAILED, req.errorCode());
assertEquals(req.toString(), "Cannot set wanted state of node storage.10. Index does not correspond to a configured node.", req.errorMessage());
req = new Request("setNodeState");
req.parameters().add(new StringValue("storage/cluster.mycluster/distributor/10"));
req.parameters().add(new StringValue("s:m"));
connection.invokeSync(req, timeoutS);
assertEquals(req.toString(), ErrorCode.METHOD_FAILED, req.errorCode());
assertEquals(req.toString(), "Cannot set wanted state of node distributor.10. Index does not correspond to a configured node.", req.errorMessage());
req = new Request("setNodeState");
req.parameters().add(new StringValue("storage/cluster.mycluster/storage/9"));
req.parameters().add(new StringValue("s:m"));
connection.invokeSync(req, timeoutS);
assertEquals(req.toString(), ErrorCode.NONE, req.errorCode());
waitForState("version:\\d+ distributor:10 storage:10 .9.s:m");
}
use of com.yahoo.vdslib.distribution.Distribution in project vespa by vespa-engine.
the class StatusPagesTest method testSimpleConnectionWithSomeContent.
@Test
public void testSimpleConnectionWithSomeContent() throws Exception {
// Set this to true temporary if you want to check status page from browser. Should be false in checked in code always.
boolean haltTestToViewStatusPage = false;
startingTest("StatusPagesTest::testSimpleConnectionWithSomeContent()");
FleetControllerOptions options = new FleetControllerOptions("mycluster");
options.setStorageDistribution(new Distribution(Distribution.getDefaultDistributionConfig(3, 10)));
// options.minRatioOfStorageNodesUp = 0.99;
if (haltTestToViewStatusPage) {
options.httpPort = 19234;
}
setUpFleetController(true, options);
setUpVdsNodes(true, new DummyVdsNodeOptions());
waitForStableSystem();
nodes.get(2).disconnectBreakConnection();
nodes.get(5).disconnectAsShutdown();
nodes.get(7).disconnectSlobrok();
fleetController.getCluster().getNodeInfo(new Node(NodeType.STORAGE, 3)).setWantedState(new NodeState(NodeType.STORAGE, State.MAINTENANCE).setDescription("Test&<>special"));
String content = doHttpGetRequest("/");
assertTrue(content, content.contains("<html>"));
assertTrue(content, content.contains("</html>"));
assertTrue(content, content.contains("Baseline cluster state"));
assertTrue(content, content.contains("Cluster states"));
assertTrue(content, content.contains("Event log"));
if (haltTestToViewStatusPage) {
System.err.println(content);
try {
Thread.sleep(1000000);
} catch (InterruptedException e) {
}
}
}
use of com.yahoo.vdslib.distribution.Distribution in project vespa by vespa-engine.
the class StatusPagesTest method testErrorResponseCode.
@Test
public void testErrorResponseCode() 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("/fraggle/rock");
assertTrue(content.contains("404 Not Found"));
// System.err.println(sb.toString());
}
Aggregations