diff --git a/server/src/main/java/io/druid/server/coordinator/helper/DruidCoordinatorRuleRunner.java b/server/src/main/java/io/druid/server/coordinator/helper/DruidCoordinatorRuleRunner.java index 03869810e85..be17219faf7 100644 --- a/server/src/main/java/io/druid/server/coordinator/helper/DruidCoordinatorRuleRunner.java +++ b/server/src/main/java/io/druid/server/coordinator/helper/DruidCoordinatorRuleRunner.java @@ -19,6 +19,7 @@ package io.druid.server.coordinator.helper; +import com.google.common.collect.Lists; import com.metamx.emitter.EmittingLogger; import io.druid.metadata.MetadataRuleManager; import io.druid.server.coordinator.CoordinatorStats; @@ -37,6 +38,7 @@ import java.util.List; public class DruidCoordinatorRuleRunner implements DruidCoordinatorHelper { private static final EmittingLogger log = new EmittingLogger(DruidCoordinatorRuleRunner.class); + private static int MAX_MISSING_RULES = 10; private final ReplicationThrottler replicatorThrottler; @@ -87,6 +89,9 @@ public class DruidCoordinatorRuleRunner implements DruidCoordinatorHelper // Run through all matched rules for available segments DateTime now = new DateTime(); MetadataRuleManager databaseRuleManager = paramsWithReplicationManager.getDatabaseRuleManager(); + + final List segmentsWithMissingRules = Lists.newArrayListWithCapacity(MAX_MISSING_RULES); + int missingRules = 0; for (DataSegment segment : paramsWithReplicationManager.getAvailableSegments()) { List rules = databaseRuleManager.getRulesWithDefault(segment.getDataSource()); boolean foundMatchingRule = false; @@ -99,13 +104,20 @@ public class DruidCoordinatorRuleRunner implements DruidCoordinatorHelper } if (!foundMatchingRule) { - log.makeAlert("Unable to find a matching rule!") - .addData("dataSource", segment.getDataSource()) - .addData("segment", segment.getIdentifier()) - .emit(); + if (segmentsWithMissingRules.size() < MAX_MISSING_RULES) { + segmentsWithMissingRules.add(segment.getIdentifier()); + } + missingRules++; } } + if (!segmentsWithMissingRules.isEmpty()) { + log.makeAlert("Unable to find matching rules!") + .addData("segmentsWithMissingRulesCount", missingRules) + .addData("segmentsWithMissingRules", segmentsWithMissingRules) + .emit(); + } + return paramsWithReplicationManager.buildFromExisting() .withCoordinatorStats(stats) .build();