maytasm commented on a change in pull request #10048:
URL: https://github.com/apache/druid/pull/10048#discussion_r442440375
##########
File path:
server/src/main/java/org/apache/druid/server/coordinator/DruidCoordinator.java
##########
@@ -280,20 +288,38 @@ public boolean isLeader()
final List<Rule> rules =
metadataRuleManager.getRulesWithDefault(segment.getDataSource());
for (final Rule rule : rules) {
- if (!(rule instanceof LoadRule && rule.appliesTo(segment, now))) {
+ if (!rule.appliesTo(segment, now)) {
continue;
}
- ((LoadRule) rule)
- .getTieredReplicants()
- .forEach((final String tier, final Integer ruleReplicants) -> {
- int currentReplicants =
segmentReplicantLookup.getLoadedReplicants(segment.getId(), tier);
- Object2LongMap<String> underReplicationPerDataSource =
underReplicationCountsPerDataSourcePerTier
- .computeIfAbsent(tier, ignored -> new
Object2LongOpenHashMap<>());
+ if (rule instanceof LoadRule) {
+ ((LoadRule) rule)
+ .getTieredReplicants()
+ .forEach((final String tier, final Integer ruleReplicants) -> {
+ int currentReplicants =
segmentReplicantLookup.getLoadedReplicants(segment.getId(), tier);
+ Object2LongMap<String> underReplicationPerDataSource =
underReplicationCountsPerDataSourcePerTier
+ .computeIfAbsent(tier, ignored -> new
Object2LongOpenHashMap<>());
+ ((Object2LongOpenHashMap<String>)
underReplicationPerDataSource)
+ .addTo(segment.getDataSource(), Math.max(ruleReplicants -
currentReplicants, 0));
+ });
+ }
+
+ if (rule instanceof BroadcastDistributionRule) {
Review comment:
Not right now. A Rule subclass may not always be needed to be considered
in this method. Also not sure how the test will be able to automatically create
new Rule subclass
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]