Source:
public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params) { replicatorThrottler.updateParams( coordinator.getDynamicConfigs().getReplicationThrottleLimit(), coordinator.getDynamicConfigs().getReplicantLifetime() ); CoordinatorStats stats = new CoordinatorStats(); DruidCluster cluster = params.getDruidCluster(); if (cluster.isEmpty()) { log.warn("Uh... I have no servers. Not assigning anything..."); return params; } final Collection<DataSegment> overshadowed = Optional .ofNullable(coordinator.getMetadataSegmentManager().findOvershadowedSegments()) .orElse(Collections.emptyList()); for (String tier : cluster.getTierNames()) { replicatorThrottler.updateReplicationState(tier); } DruidCoordinatorRuntimeParams paramsWithReplicationManager = params .buildFromExistingWithoutAvailableSegments() .withReplicationManager(replicatorThrottler) .build(); DateTime now = DateTimes.nowUtc(); MetadataRuleManager databaseRuleManager = paramsWithReplicationManager.getDatabaseRuleManager(); final List<SegmentId> segmentsWithMissingRules = Lists.newArrayListWithCapacity(MAX_MISSING_RULES); int missingRules = 0; for (DataSegment segment : params.getAvailableSegments()) { if (overshadowed.contains(segment)) { continue; } 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) { if (segmentsWithMissingRules.size() < MAX_MISSING_RULES) { segmentsWithMissingRules.add(segment.getId()); } missingRules++; } } if (!segmentsWithMissingRules.isEmpty()) { log.makeAlert("Unable to find matching rules!") .addData("segmentsWithMissingRulesCount", missingRules) .addData("segmentsWithMissingRules", segmentsWithMissingRules) .emit(); } return params.buildFromExisting().withCoordinatorStats(stats).build(); }

Target:
public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params) { replicatorThrottler.updateParams( coordinator.getDynamicConfigs().getReplicationThrottleLimit(), coordinator.getDynamicConfigs().getReplicantLifetime() ); CoordinatorStats stats = new CoordinatorStats(); DruidCluster cluster = params.getDruidCluster(); if (cluster.isEmpty()) { log.warn("Uh... I have no servers. Not assigning anything..."); return params; } final DataSourcesSnapshot dataSourcesSnapshot = params.getDataSourcesSnapshot(); Set<SegmentId> overshadowed = ImmutableSet.of(); if (dataSourcesSnapshot != null) { overshadowed = Optional .ofNullable(dataSourcesSnapshot.getOvershadowedSegments()) .orElse(ImmutableSet.of()); } for (String tier : cluster.getTierNames()) { replicatorThrottler.updateReplicationState(tier); } DruidCoordinatorRuntimeParams paramsWithReplicationManager = params .buildFromExistingWithoutAvailableSegments() .withReplicationManager(replicatorThrottler) .build(); DateTime now = DateTimes.nowUtc(); MetadataRuleManager databaseRuleManager = paramsWithReplicationManager.getDatabaseRuleManager(); final List<SegmentId> segmentsWithMissingRules = Lists.newArrayListWithCapacity(MAX_MISSING_RULES); int missingRules = 0; for (DataSegment segment : params.getAvailableSegments()) { if (overshadowed.contains(segment.getId())) { continue; } 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) { if (segmentsWithMissingRules.size() < MAX_MISSING_RULES) { segmentsWithMissingRules.add(segment.getId()); } missingRules++; } } if (!segmentsWithMissingRules.isEmpty()) { log.makeAlert("Unable to find matching rules!") .addData("segmentsWithMissingRulesCount", missingRules) .addData("segmentsWithMissingRules", segmentsWithMissingRules) .emit(); } return params.buildFromExisting().withCoordinatorStats(stats).build(); }