for (String tier : cluster.getTierNames()) {
replicatorThrottler.updateReplicationState(tier);
replicatorThrottler.updateTerminationState(tier);
}
DruidCoordinatorRuntimeParams paramsWithReplicationManager = params.buildFromExisting()
.withReplicationManager(replicatorThrottler)
.build();
// Run through all matched rules for available segments
DateTime now = new DateTime();
MetadataRuleManager databaseRuleManager = paramsWithReplicationManager.getDatabaseRuleManager();
for (DataSegment segment : paramsWithReplicationManager.getAvailableSegments()) {
List<Rule> rules = databaseRuleManager.getRulesWithDefault(segment.getDataSource());
boolean foundMatchingRule = false;
for (Rule rule : rules) {
if (rule.appliesTo(segment, now)) {
stats.accumulate(rule.run(coordinator, paramsWithReplicationManager, segment));
foundMatchingRule = true;
break;
}
}
if (!foundMatchingRule) {
log.makeAlert("Unable to find a matching rule!")
.addData("dataSource", segment.getDataSource())
.addData("segment", segment.getIdentifier())
.emit();
}
}
return paramsWithReplicationManager.buildFromExisting()
.withCoordinatorStats(stats)
.build();
}