You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/02/13 23:06:29 UTC

[GitHub] samarthjain opened a new issue #7072: Remove unnecessary check in LoadRule

samarthjain opened a new issue #7072: Remove unnecessary check in LoadRule
URL: https://github.com/apache/incubator-druid/issues/7072
 
 
   In LoadRule#run, we check whether segment is contained within params.getAvailableSegments()
   ```
    if (params.getAvailableSegments().contains(segment)) {
           assign(params, segment, stats);
    }
   ```
   
   This check is not needed since DruidCoordinatorRuleRunner runs the rule for the segment that is part of params.getAvailableSegments()
   
   ```
      for (DataSegment segment : paramsWithReplicationManager.getAvailableSegments()) {
               List<Rule> rules = databaseRuleManager.getRulesWithDefault(segment.getDataSource());
              .....
              stats.accumulate(rule.run(coordinator, paramsWithReplicationManager, segment));
           }
      }
   ```
   `availableSegments` is a TreeSet making contains() is an O(log n) operation thereby making the code block above O(nlogn). For a cluster with large number of segments this can get expensive. 
    
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org