use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.
the class ModelProvisioningTest method test2ContentNodesWithContainerClusterProducesMixedClusterControllerCluster.
@Test
public void test2ContentNodesWithContainerClusterProducesMixedClusterControllerCluster() throws ParseException {
String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + " <container version='1.0' id='foo'>" + " <nodes count='3'/>" + " </container>" + " <content version='1.0' id='bar'>" + " <redundancy>2</redundancy>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <nodes count='2'/>" + " </content>" + "</services>";
VespaModelTester tester = new VespaModelTester();
tester.addHosts(5);
VespaModel model = tester.createModel(services, true);
ContentCluster cluster = model.getContentClusters().get("bar");
ContainerCluster clusterControllers = cluster.getClusterControllers();
// TODO: Expected 3 with this feature reactivated
assertEquals(1, clusterControllers.getContainers().size());
}
use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.
the class ModelProvisioningTest method testClusterControllersWithGroupSize2.
@Test
public void testClusterControllersWithGroupSize2() {
String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + " <admin version='4.0'/>" + " <container version='1.0' id='foo'>" + " <nodes count='10'/>" + " </container>" + " <content version='1.0' id='bar'>" + " <redundancy>2</redundancy>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <nodes count='8' groups='4'/>" + " </content>" + "</services>";
int numberOfHosts = 18;
VespaModelTester tester = new VespaModelTester();
tester.addHosts(numberOfHosts);
VespaModel model = tester.createModel(services, true);
assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
// Check content clusters
ContentCluster cluster = model.getContentClusters().get("bar");
ContainerCluster clusterControllers = cluster.getClusterControllers();
assertEquals("We get the closest odd number", 3, clusterControllers.getContainers().size());
assertEquals("bar-controllers", clusterControllers.getName());
assertEquals("default01", clusterControllers.getContainers().get(0).getHostName());
assertEquals("default03", clusterControllers.getContainers().get(1).getHostName());
assertEquals("default08", clusterControllers.getContainers().get(2).getHostName());
}
use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.
the class ModelProvisioningTest method testExplicitDedicatedClusterControllers.
@Test
public void testExplicitDedicatedClusterControllers() {
String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + " <container version='1.0' id='foo'>" + " <nodes count='10'/>" + " </container>" + " <content version='1.0' id='bar'>" + " <redundancy>2</redundancy>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <controllers><nodes dedicated='true' count='4'/></controllers>" + " <nodes count='9' groups='3'/>" + " </content>" + "</services>";
int numberOfHosts = 23;
VespaModelTester tester = new VespaModelTester();
tester.addHosts(numberOfHosts);
VespaModel model = tester.createModel(services, true);
assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
// Check content clusters
ContentCluster cluster = model.getContentClusters().get("bar");
ContainerCluster clusterControllers = cluster.getClusterControllers();
assertEquals(4, clusterControllers.getContainers().size());
assertEquals("bar-controllers", clusterControllers.getName());
assertEquals("default04", clusterControllers.getContainers().get(0).getHostName());
assertEquals("default03", clusterControllers.getContainers().get(1).getHostName());
assertEquals("default02", clusterControllers.getContainers().get(2).getHostName());
assertEquals("default01", clusterControllers.getContainers().get(3).getHostName());
}
use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.
the class ModelProvisioningTest method testUsingNodesCountAttributesAndGettingJustOneNode.
@Test
public void testUsingNodesCountAttributesAndGettingJustOneNode() {
String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + " <admin version='3.0'>" + // Ignored
" <nodes count='3'/>" + " </admin>" + " <content version='1.0' id='bar'>" + " <redundancy reply-after='8'>12</redundancy>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <nodes count='24'/>" + " <engine><proton><searchable-copies>5</searchable-copies></proton></engine>" + " <dispatch><num-dispatch-groups>7</num-dispatch-groups></dispatch>" + " </content>" + "</services>";
int numberOfHosts = 1;
VespaModelTester tester = new VespaModelTester();
tester.addHosts(numberOfHosts);
VespaModel model = tester.createModel(services, false);
assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
ContentCluster cluster = model.getContentClusters().get("bar");
assertEquals(1, cluster.redundancy().effectiveInitialRedundancy());
assertEquals(1, cluster.redundancy().effectiveFinalRedundancy());
assertEquals(1, cluster.redundancy().effectiveReadyCopies());
assertEquals(1, cluster.getSearch().getIndexed().getDispatchSpec().getGroups().size());
assertFalse(cluster.getRootGroup().getPartitions().isPresent());
assertEquals(1, cluster.getRootGroup().getNodes().size());
assertEquals(0, cluster.getRootGroup().getSubgroups().size());
assertThat(cluster.getRootGroup().getNodes().size(), is(1));
assertThat(cluster.getRootGroup().getNodes().get(0).getDistributionKey(), is(0));
assertThat(cluster.getRootGroup().getNodes().get(0).getConfigId(), is("bar/storage/0"));
}
use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.
the class DocumentProtocol method addContentRouting.
/**
* Create hops to all configured storage nodes for the Document protocol. The "Distributor" policy resolves its
* recipients using slobrok lookups, so it requires no configured recipients.
*
* @param content The storage model from {@link com.yahoo.vespa.model.VespaModel}.
* @param table The routing table to add to.
*/
private static void addContentRouting(List<ContentCluster> content, RoutingTableSpec table) {
for (ContentCluster cluster : content) {
RouteSpec spec = new RouteSpec(cluster.getConfigId());
if (cluster.getSearch().hasIndexedCluster()) {
table.addRoute(spec.addHop("[MessageType:" + cluster.getConfigId() + "]"));
table.addRoute(new RouteSpec(getIndexedRouteName(cluster.getConfigId())).addHop(cluster.getSearch().getIndexed().getIndexingServiceName()).addHop("[Content:cluster=" + cluster.getName() + "]"));
table.addRoute(new RouteSpec(getDirectRouteName(cluster.getConfigId())).addHop("[Content:cluster=" + cluster.getName() + "]"));
} else {
table.addRoute(spec.addHop("[Content:cluster=" + cluster.getName() + "]"));
}
table.addRoute(new RouteSpec("storage/cluster." + cluster.getName()).addHop("route:" + cluster.getConfigId()));
}
}
Aggregations