Xiang Fu
Ting Chen
08/14/2019, 6:46 PMTing Chen
08/14/2019, 6:49 PMKishore G
Kishore G
Kishore G
Ting Chen
08/14/2019, 7:18 PMTing Chen
08/14/2019, 7:19 PMXiang Fu
/**
* Given an external view and a list of instance configs, computes the mapping of segment to servers. The mapping
* will be cached if we use dynamic routing. By default, this will check ONLINE segments and active servers.
*
* @param externalView an external view
* @param instanceConfigs a list of instance config
* @return a mapping of segment to servers
*/
protected Map<String, List<String>> computeSegmentToServersMapFromExternalView(ExternalView externalView,
List<InstanceConfig> instanceConfigs) {
Map<String, List<String>> segmentToServersMap = new HashMap<>();
RoutingTableInstancePruner instancePruner = new RoutingTableInstancePruner(instanceConfigs);
for (String segmentName : externalView.getPartitionSet()) {
// List of servers that are active and are serving the segment
List<String> servers = new ArrayList<>();
for (Map.Entry<String, String> entry : externalView.getStateMap(segmentName).entrySet()) {
String serverName = entry.getKey();
if (entry.getValue().equals(<http://CommonConstants.Helix.StateModel.SegmentOnlineOfflineStateModel.ONLINE|CommonConstants.Helix.StateModel.SegmentOnlineOfflineStateModel.ONLINE>)
&& !instancePruner.isInactive(serverName)) {
servers.add(serverName);
}
}
if (!servers.isEmpty()) {
segmentToServersMap.put(segmentName, servers);
} else {
handleNoServingHost(segmentName);
}
}
return segmentToServersMap;
}
Xiang Fu
Subbu Subramaniam
08/14/2019, 8:01 PMXiang Fu
Ting Chen
08/14/2019, 9:14 PMChinmay Soman
08/15/2019, 6:45 PMDheeraj Dwivedi
08/21/2019, 7:21 AMKishore G
abk
08/22/2019, 3:13 PMabk
08/22/2019, 3:14 PMabk
08/22/2019, 3:14 PMKishore G
Kishore G
abk
08/22/2019, 3:18 PMKishore G
abk
08/22/2019, 3:20 PMabk
08/22/2019, 3:20 PMKishore G
Kishore G
abk
08/22/2019, 3:21 PMabk
08/22/2019, 3:21 PM