use of com.linkedin.pinot.common.utils.HLCSegmentName in project pinot by linkedin.
the class PinotRealtimeSegmentManager method assignRealtimeSegmentsToServerInstancesIfNecessary.
private synchronized void assignRealtimeSegmentsToServerInstancesIfNecessary() throws JSONException, IOException {
// Fetch current ideal state snapshot
Map<String, IdealState> idealStateMap = new HashMap<String, IdealState>();
for (String resource : _pinotHelixResourceManager.getAllRealtimeTables()) {
final String tableName = TableNameBuilder.extractRawTableName(resource);
AbstractTableConfig tableConfig = _pinotHelixResourceManager.getTableConfig(tableName, TableType.REALTIME);
KafkaStreamMetadata metadata = new KafkaStreamMetadata(tableConfig.getIndexingConfig().getStreamConfigs());
if (metadata.hasHighLevelKafkaConsumerType()) {
idealStateMap.put(resource, _pinotHelixResourceManager.getHelixAdmin().getResourceIdealState(_pinotHelixResourceManager.getHelixClusterName(), resource));
} else {
LOGGER.debug("Not considering table {} for realtime segment assignment");
}
}
List<Pair<String, String>> listOfSegmentsToAddToInstances = new ArrayList<Pair<String, String>>();
for (String resource : idealStateMap.keySet()) {
try {
IdealState state = idealStateMap.get(resource);
// Are there any partitions?
if (state.getPartitionSet().size() == 0) {
// No, this is a brand new ideal state, so we will add one new segment to every partition and replica
List<String> instancesInResource = new ArrayList<String>();
try {
instancesInResource.addAll(_pinotHelixResourceManager.getServerInstancesForTable(resource, TableType.REALTIME));
} catch (Exception e) {
LOGGER.error("Caught exception while fetching instances for resource {}", resource, e);
_controllerMetrics.addMeteredGlobalValue(ControllerMeter.CONTROLLER_REALTIME_TABLE_SEGMENT_ASSIGNMENT_ERROR, 1L);
}
// Assign a new segment to all server instances
for (String instanceId : instancesInResource) {
InstanceZKMetadata instanceZKMetadata = _pinotHelixResourceManager.getInstanceZKMetadata(instanceId);
if (instanceZKMetadata == null) {
LOGGER.warn("Instance {} has no associated instance metadata in ZK, ignoring for segment assignment.", instanceId);
_controllerMetrics.addMeteredGlobalValue(ControllerMeter.CONTROLLER_REALTIME_TABLE_SEGMENT_ASSIGNMENT_ERROR, 1L);
continue;
}
String groupId = instanceZKMetadata.getGroupId(resource);
String partitionId = instanceZKMetadata.getPartition(resource);
if (groupId != null && !groupId.isEmpty() && partitionId != null && !partitionId.isEmpty()) {
listOfSegmentsToAddToInstances.add(new Pair<String, String>(new HLCSegmentName(groupId, partitionId, String.valueOf(System.currentTimeMillis())).getSegmentName(), instanceId));
} else {
LOGGER.warn("Instance {} has invalid groupId ({}) and/or partitionId ({}) for resource {}, ignoring for segment assignment.", instanceId, groupId, partitionId, resource);
_controllerMetrics.addMeteredGlobalValue(ControllerMeter.CONTROLLER_REALTIME_TABLE_SEGMENT_ASSIGNMENT_ERROR, 1L);
}
}
} else {
// Add all server instances to the list of instances for which to assign a realtime segment
Set<String> instancesToAssignRealtimeSegment = new HashSet<String>();
try {
instancesToAssignRealtimeSegment.addAll(_pinotHelixResourceManager.getServerInstancesForTable(resource, TableType.REALTIME));
} catch (Exception e) {
LOGGER.error("Caught exception while fetching instances for resource {}", resource, e);
_controllerMetrics.addMeteredGlobalValue(ControllerMeter.CONTROLLER_REALTIME_TABLE_SEGMENT_ASSIGNMENT_ERROR, 1L);
}
// Remove server instances that are currently processing a segment
for (String partition : state.getPartitionSet()) {
// Helix partition is the segment name
if (SegmentName.isHighLevelConsumerSegmentName(partition)) {
HLCSegmentName segName = new HLCSegmentName(partition);
RealtimeSegmentZKMetadata realtimeSegmentZKMetadata = ZKMetadataProvider.getRealtimeSegmentZKMetadata(_pinotHelixResourceManager.getPropertyStore(), segName.getTableName(), partition);
if (realtimeSegmentZKMetadata == null) {
// Segment was deleted by retention manager.
continue;
}
if (realtimeSegmentZKMetadata.getStatus() == Status.IN_PROGRESS) {
instancesToAssignRealtimeSegment.removeAll(state.getInstanceSet(partition));
}
}
}
// Assign a new segment to the server instances not currently processing this segment
for (String instanceId : instancesToAssignRealtimeSegment) {
InstanceZKMetadata instanceZKMetadata = _pinotHelixResourceManager.getInstanceZKMetadata(instanceId);
String groupId = instanceZKMetadata.getGroupId(resource);
String partitionId = instanceZKMetadata.getPartition(resource);
listOfSegmentsToAddToInstances.add(new Pair<String, String>(new HLCSegmentName(groupId, partitionId, String.valueOf(System.currentTimeMillis())).getSegmentName(), instanceId));
}
}
} catch (Exception e) {
LOGGER.warn("Caught exception while processing resource {}, skipping.", resource, e);
_controllerMetrics.addMeteredGlobalValue(ControllerMeter.CONTROLLER_REALTIME_TABLE_SEGMENT_ASSIGNMENT_ERROR, 1L);
}
}
LOGGER.info("Computed list of new segments to add : " + Arrays.toString(listOfSegmentsToAddToInstances.toArray()));
// Add the new segments to the server instances
for (final Pair<String, String> segmentIdAndInstanceId : listOfSegmentsToAddToInstances) {
final String segmentId = segmentIdAndInstanceId.getFirst();
final String instanceName = segmentIdAndInstanceId.getSecond();
try {
final HLCSegmentName segName = new HLCSegmentName(segmentId);
String resourceName = segName.getTableName();
// Does the ideal state already contain this segment?
if (!idealStateMap.get(resourceName).getPartitionSet().contains(segmentId)) {
// No, add it
// Create the realtime segment metadata
RealtimeSegmentZKMetadata realtimeSegmentMetadataToAdd = new RealtimeSegmentZKMetadata();
realtimeSegmentMetadataToAdd.setTableName(TableNameBuilder.extractRawTableName(resourceName));
realtimeSegmentMetadataToAdd.setSegmentType(SegmentType.REALTIME);
realtimeSegmentMetadataToAdd.setStatus(Status.IN_PROGRESS);
realtimeSegmentMetadataToAdd.setSegmentName(segmentId);
// Add the new metadata to the property store
ZKMetadataProvider.setRealtimeSegmentZKMetadata(_pinotHelixResourceManager.getPropertyStore(), realtimeSegmentMetadataToAdd);
// Update the ideal state to add the new realtime segment
HelixHelper.updateIdealState(_pinotHelixResourceManager.getHelixZkManager(), resourceName, new Function<IdealState, IdealState>() {
@Override
public IdealState apply(IdealState idealState) {
return PinotTableIdealStateBuilder.addNewRealtimeSegmentToIdealState(segmentId, idealState, instanceName);
}
}, RetryPolicies.exponentialBackoffRetryPolicy(5, 500L, 2.0f));
}
} catch (Exception e) {
LOGGER.warn("Caught exception while processing segment {} for instance {}, skipping.", segmentId, instanceName, e);
_controllerMetrics.addMeteredGlobalValue(ControllerMeter.CONTROLLER_REALTIME_TABLE_SEGMENT_ASSIGNMENT_ERROR, 1L);
}
}
}
use of com.linkedin.pinot.common.utils.HLCSegmentName in project pinot by linkedin.
the class ValidationManager method computeRealtimeTotalDocumentInSegments.
public static long computeRealtimeTotalDocumentInSegments(List<SegmentMetadata> segmentMetadataList, boolean countHLCSegments) {
long totalDocumentCount = 0;
String groupId = "";
for (SegmentMetadata segmentMetadata : segmentMetadataList) {
String segmentName = segmentMetadata.getName();
if (SegmentName.isHighLevelConsumerSegmentName(segmentName)) {
if (countHLCSegments) {
HLCSegmentName hlcSegmentName = new HLCSegmentName(segmentName);
String segmentGroupIdName = hlcSegmentName.getGroupId();
if (groupId.isEmpty()) {
groupId = segmentGroupIdName;
}
// Discard all segments with different groupids as they are replicas
if (groupId.equals(segmentGroupIdName) && segmentMetadata.getTotalRawDocs() >= 0) {
totalDocumentCount += segmentMetadata.getTotalRawDocs();
}
}
} else {
// Low level segments
if (!countHLCSegments) {
totalDocumentCount += segmentMetadata.getTotalRawDocs();
}
}
}
return totalDocumentCount;
}
use of com.linkedin.pinot.common.utils.HLCSegmentName in project pinot by linkedin.
the class KafkaHighLevelConsumerBasedRoutingTableBuilder method computeRoutingTableFromExternalView.
@Override
public List<ServerToSegmentSetMap> computeRoutingTableFromExternalView(String tableName, ExternalView externalView, List<InstanceConfig> instanceConfigList) {
RoutingTableInstancePruner pruner = new RoutingTableInstancePruner(instanceConfigList);
Set<String> segments = externalView.getPartitionSet();
List<ServerToSegmentSetMap> routingTable = new ArrayList<ServerToSegmentSetMap>();
Map<String, Map<String, Set<String>>> groupIdToRouting = new HashMap<String, Map<String, Set<String>>>();
for (String segment : segments) {
Map<String, String> instanceMap = externalView.getStateMap(segment);
for (String instance : instanceMap.keySet()) {
if (!instanceMap.get(instance).equals(CommonConstants.Helix.StateModel.SegmentOnlineOfflineStateModel.ONLINE) || pruner.isInactive(instance)) {
continue;
}
// Skip segments that are not high level consumer segments
if (!SegmentName.isHighLevelConsumerSegmentName(segment))
continue;
HLCSegmentName hlcSegmentName = new HLCSegmentName(segment);
String groupId = hlcSegmentName.getGroupId();
if (!groupIdToRouting.containsKey(groupId)) {
groupIdToRouting.put(groupId, new HashMap<String, Set<String>>());
}
if (!groupIdToRouting.get(groupId).containsKey(instance)) {
groupIdToRouting.get(groupId).put(instance, new HashSet<String>());
}
groupIdToRouting.get(groupId).get(instance).add(segment);
}
}
for (Map<String, Set<String>> replicaRouting : groupIdToRouting.values()) {
routingTable.add(new ServerToSegmentSetMap(replicaRouting));
}
return routingTable;
}
use of com.linkedin.pinot.common.utils.HLCSegmentName in project pinot by linkedin.
the class RoutingTableTest method testKafkaHighLevelConsumerBasedRoutingTable.
@Test
public void testKafkaHighLevelConsumerBasedRoutingTable() throws Exception {
RoutingTableBuilder routingStrategy = new KafkaHighLevelConsumerBasedRoutingTableBuilder();
final String group0 = "testResource0_REALTIME_1433316466991_0";
final String group1 = "testResource1_REALTIME_1433316490099_1";
final String group2 = "testResource2_REALTIME_1436589344583_1";
final LLCSegmentName llcSegmentName = new LLCSegmentName("testResource0", 2, 65, System.currentTimeMillis());
HelixExternalViewBasedRouting routingTable = new HelixExternalViewBasedRouting(null, NO_LLC_ROUTING, null, new BaseConfiguration());
Field realtimeRTBField = HelixExternalViewBasedRouting.class.getDeclaredField("_realtimeHLCRoutingTableBuilder");
realtimeRTBField.setAccessible(true);
realtimeRTBField.set(routingTable, routingStrategy);
ExternalView externalView = new ExternalView("testResource0_REALTIME");
// Toss in an llc segment in the mix. Should not affect the results
externalView.setState(llcSegmentName.getSegmentName(), "dataServer_instance_0", "CONSUMING");
externalView.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "0").getSegmentName(), "dataServer_instance_0", "ONLINE");
externalView.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "1").getSegmentName(), "dataServer_instance_1", "ONLINE");
externalView.setState(new HLCSegmentName(group1, ALL_PARTITIONS, "2").getSegmentName(), "dataServer_instance_2", "ONLINE");
externalView.setState(new HLCSegmentName(group1, ALL_PARTITIONS, "3").getSegmentName(), "dataServer_instance_3", "ONLINE");
externalView.setState(new HLCSegmentName(group2, ALL_PARTITIONS, "4").getSegmentName(), "dataServer_instance_4", "ONLINE");
externalView.setState(new HLCSegmentName(group2, ALL_PARTITIONS, "5").getSegmentName(), "dataServer_instance_5", "ONLINE");
routingTable.markDataResourceOnline("testResource0_REALTIME", externalView, generateInstanceConfigs("dataServer_instance", 0, 5));
ExternalView externalView1 = new ExternalView("testResource1_REALTIME");
externalView1.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "10").getSegmentName(), "dataServer_instance_10", "ONLINE");
externalView1.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "11").getSegmentName(), "dataServer_instance_11", "ONLINE");
externalView1.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "12").getSegmentName(), "dataServer_instance_12", "ONLINE");
routingTable.markDataResourceOnline("testResource1_REALTIME", externalView1, generateInstanceConfigs("dataServer_instance", 10, 12));
ExternalView externalView2 = new ExternalView("testResource2_REALTIME");
externalView2.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "20").getSegmentName(), "dataServer_instance_20", "ONLINE");
externalView2.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "21").getSegmentName(), "dataServer_instance_21", "ONLINE");
externalView2.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "22").getSegmentName(), "dataServer_instance_22", "ONLINE");
externalView2.setState(new HLCSegmentName(group1, ALL_PARTITIONS, "23").getSegmentName(), "dataServer_instance_23", "ONLINE");
externalView2.setState(new HLCSegmentName(group1, ALL_PARTITIONS, "24").getSegmentName(), "dataServer_instance_24", "ONLINE");
externalView2.setState(new HLCSegmentName(group1, ALL_PARTITIONS, "25").getSegmentName(), "dataServer_instance_25", "ONLINE");
externalView2.setState(new HLCSegmentName(group2, ALL_PARTITIONS, "26").getSegmentName(), "dataServer_instance_26", "ONLINE");
externalView2.setState(new HLCSegmentName(group2, ALL_PARTITIONS, "27").getSegmentName(), "dataServer_instance_27", "ONLINE");
externalView2.setState(new HLCSegmentName(group2, ALL_PARTITIONS, "28").getSegmentName(), "dataServer_instance_28", "ONLINE");
routingTable.markDataResourceOnline("testResource2_REALTIME", externalView2, generateInstanceConfigs("dataServer_instance", 20, 28));
for (int numRun = 0; numRun < 100; ++numRun) {
assertResourceRequest(routingTable, "testResource0_REALTIME", new String[] { "[" + new HLCSegmentName(group0, ALL_PARTITIONS, "0").getSegmentName() + ", " + new HLCSegmentName(group0, ALL_PARTITIONS, "1").getSegmentName() + "]", "[" + new HLCSegmentName(group1, ALL_PARTITIONS, "2").getSegmentName() + ", " + new HLCSegmentName(group1, ALL_PARTITIONS, "3").getSegmentName() + "]", "[" + new HLCSegmentName(group2, ALL_PARTITIONS, "4").getSegmentName() + ", " + new HLCSegmentName(group2, ALL_PARTITIONS, "5").getSegmentName() + "]" }, 2);
}
for (int numRun = 0; numRun < 100; ++numRun) {
assertResourceRequest(routingTable, "testResource1_REALTIME", new String[] { "[" + new HLCSegmentName(group0, ALL_PARTITIONS, "10").getSegmentName() + ", " + new HLCSegmentName(group0, ALL_PARTITIONS, "11").getSegmentName() + ", " + new HLCSegmentName(group0, ALL_PARTITIONS, "12").getSegmentName() + "]" }, 3);
}
for (int numRun = 0; numRun < 100; ++numRun) {
assertResourceRequest(routingTable, "testResource2_REALTIME", new String[] { "[" + new HLCSegmentName(group0, ALL_PARTITIONS, "20").getSegmentName() + ", " + new HLCSegmentName(group0, ALL_PARTITIONS, "21").getSegmentName() + ", " + new HLCSegmentName(group0, ALL_PARTITIONS, "22").getSegmentName() + "]", "[" + new HLCSegmentName(group1, ALL_PARTITIONS, "23").getSegmentName() + ", " + new HLCSegmentName(group1, ALL_PARTITIONS, "24").getSegmentName() + ", " + new HLCSegmentName(group1, ALL_PARTITIONS, "25").getSegmentName() + "]", "[" + new HLCSegmentName(group2, ALL_PARTITIONS, "26").getSegmentName() + ", " + new HLCSegmentName(group2, ALL_PARTITIONS, "27").getSegmentName() + ", " + new HLCSegmentName(group2, ALL_PARTITIONS, "28").getSegmentName() + "]" }, 3);
}
}
use of com.linkedin.pinot.common.utils.HLCSegmentName in project pinot by linkedin.
the class RoutingTableTest method testCombinedKafkaRouting.
// Test that we can switch between llc and hlc routing depending on what the selector tells us.
@Test
public void testCombinedKafkaRouting() throws Exception {
HelixExternalViewBasedRouting routingTable = new HelixExternalViewBasedRouting(null, NO_LLC_ROUTING, null, new BaseConfiguration());
final long now = System.currentTimeMillis();
final String tableName = "table";
final String resourceName = tableName + "_REALTIME";
final String group1 = resourceName + "_" + Long.toString(now) + "_0";
final String group2 = resourceName + "_" + Long.toString(now) + "_1";
final String online = "ONLINE";
final String consuming = "CONSUMING";
final int partitionId = 1;
final String partitionRange = "JUNK";
final int segId1 = 1;
final int segId2 = 2;
final int port1 = 1;
final int port2 = 2;
final String host = "host";
final ServerInstance serverInstance1 = new ServerInstance(host, port1);
final ServerInstance serverInstance2 = new ServerInstance(host, port2);
final String helixInstance1 = CommonConstants.Helix.PREFIX_OF_SERVER_INSTANCE + serverInstance1;
final String helixInstance2 = CommonConstants.Helix.PREFIX_OF_SERVER_INSTANCE + serverInstance2;
final HLCSegmentName s1HlcSegment1 = new HLCSegmentName(group1, partitionRange, Integer.toString(segId1));
final HLCSegmentName s1HlcSegment2 = new HLCSegmentName(group1, partitionRange, Integer.toString(segId2));
final HLCSegmentName s2HlcSegment1 = new HLCSegmentName(group2, partitionRange, Integer.toString(segId1));
final HLCSegmentName s2HlcSegment2 = new HLCSegmentName(group2, partitionRange, Integer.toString(segId2));
final LLCSegmentName llcSegment1 = new LLCSegmentName(tableName, partitionId, segId1, now);
final LLCSegmentName llcSegment2 = new LLCSegmentName(tableName, partitionId, segId2, now);
final List<InstanceConfig> instanceConfigs = new ArrayList<>(2);
instanceConfigs.add(new InstanceConfig(helixInstance1));
instanceConfigs.add(new InstanceConfig(helixInstance2));
ExternalView ev = new ExternalView(resourceName);
ev.setState(s1HlcSegment1.getSegmentName(), helixInstance1, online);
ev.setState(s1HlcSegment2.getSegmentName(), helixInstance1, online);
ev.setState(llcSegment1.getSegmentName(), helixInstance2, online);
ev.setState(llcSegment2.getSegmentName(), helixInstance2, consuming);
routingTable.markDataResourceOnline(resourceName, ev, instanceConfigs);
RoutingTableLookupRequest request = new RoutingTableLookupRequest(resourceName, Collections.<String>emptyList());
for (int i = 0; i < 100; i++) {
Map<ServerInstance, SegmentIdSet> routingMap = routingTable.findServers(request);
Assert.assertEquals(routingMap.size(), 1);
List<String> segments = routingMap.get(serverInstance1).getSegmentsNameList();
Assert.assertEquals(segments.size(), 2);
Assert.assertTrue(segments.contains(s1HlcSegment1.getSegmentName()));
Assert.assertTrue(segments.contains(s1HlcSegment2.getSegmentName()));
}
// Now change the percent value in the routing table selector to be 100, and we should get only LLC segments.
Configuration configuration = new PropertiesConfiguration();
configuration.addProperty("class", PercentageBasedRoutingTableSelector.class.getName());
configuration.addProperty("table." + resourceName, new Integer(100));
RoutingTableSelector selector = RoutingTableSelectorFactory.getRoutingTableSelector(configuration, null);
selector.init(configuration, null);
Field selectorField = HelixExternalViewBasedRouting.class.getDeclaredField("_routingTableSelector");
selectorField.setAccessible(true);
selectorField.set(routingTable, selector);
// And we should find only LLC segments.
for (int i = 0; i < 100; i++) {
Map<ServerInstance, SegmentIdSet> routingMap = routingTable.findServers(request);
Assert.assertEquals(routingMap.size(), 1);
List<String> segments = routingMap.get(serverInstance2).getSegmentsNameList();
Assert.assertEquals(segments.size(), 2);
Assert.assertTrue(segments.contains(llcSegment1.getSegmentName()));
Assert.assertTrue(segments.contains(llcSegment2.getSegmentName()));
}
// Now change it to 50, and we should find both (at least 10 times each).
configuration = new PropertiesConfiguration();
configuration.addProperty("table." + resourceName, new Integer(50));
selector = new PercentageBasedRoutingTableSelector();
selector.init(configuration, null);
selectorField.set(routingTable, selector);
int hlc = 0;
int llc = 0;
for (int i = 0; i < 100; i++) {
Map<ServerInstance, SegmentIdSet> routingMap = routingTable.findServers(request);
Assert.assertEquals(routingMap.size(), 1);
if (routingMap.containsKey(serverInstance2)) {
List<String> segments = routingMap.get(serverInstance2).getSegmentsNameList();
Assert.assertEquals(segments.size(), 2);
Assert.assertTrue(segments.contains(llcSegment1.getSegmentName()));
Assert.assertTrue(segments.contains(llcSegment2.getSegmentName()));
llc++;
} else {
List<String> segments = routingMap.get(serverInstance1).getSegmentsNameList();
Assert.assertEquals(segments.size(), 2);
Assert.assertTrue(segments.contains(s1HlcSegment1.getSegmentName()));
Assert.assertTrue(segments.contains(s1HlcSegment2.getSegmentName()));
hlc++;
}
}
// If we do the above iteration 100 times, we should get at least 10 of each type of routing.
// If this test fails
Assert.assertTrue(hlc >= 10, "Got low values hlc=" + hlc + ",llc=" + llc);
Assert.assertTrue(llc >= 10, "Got low values hlc=" + hlc + ",llc=" + llc);
// Check that force HLC works
request = new RoutingTableLookupRequest(resourceName, Collections.singletonList("FORCE_HLC"));
hlc = 0;
llc = 0;
for (int i = 0; i < 100; i++) {
Map<ServerInstance, SegmentIdSet> routingMap = routingTable.findServers(request);
Assert.assertEquals(routingMap.size(), 1);
if (routingMap.containsKey(serverInstance2)) {
List<String> segments = routingMap.get(serverInstance2).getSegmentsNameList();
Assert.assertEquals(segments.size(), 2);
Assert.assertTrue(segments.contains(llcSegment1.getSegmentName()));
Assert.assertTrue(segments.contains(llcSegment2.getSegmentName()));
llc++;
} else {
List<String> segments = routingMap.get(serverInstance1).getSegmentsNameList();
Assert.assertEquals(segments.size(), 2);
Assert.assertTrue(segments.contains(s1HlcSegment1.getSegmentName()));
Assert.assertTrue(segments.contains(s1HlcSegment2.getSegmentName()));
hlc++;
}
}
Assert.assertEquals(hlc, 100);
Assert.assertEquals(llc, 0);
// Check that force LLC works
request = new RoutingTableLookupRequest(resourceName, Collections.singletonList("FORCE_LLC"));
hlc = 0;
llc = 0;
for (int i = 0; i < 100; i++) {
Map<ServerInstance, SegmentIdSet> routingMap = routingTable.findServers(request);
Assert.assertEquals(routingMap.size(), 1);
if (routingMap.containsKey(serverInstance2)) {
List<String> segments = routingMap.get(serverInstance2).getSegmentsNameList();
Assert.assertEquals(segments.size(), 2);
Assert.assertTrue(segments.contains(llcSegment1.getSegmentName()));
Assert.assertTrue(segments.contains(llcSegment2.getSegmentName()));
llc++;
} else {
List<String> segments = routingMap.get(serverInstance1).getSegmentsNameList();
Assert.assertEquals(segments.size(), 2);
Assert.assertTrue(segments.contains(s1HlcSegment1.getSegmentName()));
Assert.assertTrue(segments.contains(s1HlcSegment2.getSegmentName()));
hlc++;
}
}
Assert.assertEquals(hlc, 0);
Assert.assertEquals(llc, 100);
}
Aggregations