QiuMM commented on a change in pull request #6676: Handoff should ignore 
segments that are dropped by drop rules
URL: https://github.com/apache/incubator-druid/pull/6676#discussion_r237341966
 
 

 ##########
 File path: server/src/main/java/org/apache/druid/server/http/RulesResource.java
 ##########
 @@ -152,6 +155,30 @@ public Response getDatasourceRuleHistory(
     }
   }
 
+  @GET
+  @Path("/{dataSourceName}/intervals/{interval}/dropped")
+  @Produces(MediaType.APPLICATION_JSON)
+  @ResourceFilters(RulesResourceFilter.class)
+  public Response isSpecificIntervalDroppedByRule(
+      @PathParam("dataSourceName") String dataSourceName,
+      @PathParam("interval") String interval
+  )
+  {
+    final List<Rule> rules = 
databaseRuleManager.getRulesWithDefault(dataSourceName);
+    final Interval theInterval = Intervals.of(interval.replace('_', '/'));
+    final DateTime now = DateTimes.nowUtc();
+    boolean dropped = false;
+    for (Rule rule : rules) {
+      if (rule.appliesTo(theInterval, now)) {
+        if (rule instanceof DropRule) {
+          dropped = true;
 
 Review comment:
   Below is the whole loop:
   ```java
   boolean dropped = false;
       for (Rule rule : rules) {
         if (rule.appliesTo(theInterval, now)) {
           if (rule instanceof DropRule) {
             dropped = true;
           }
           break;
         }
       }
   ```
   So when found the first matched rule, the loop will break.
   I'll update this PR to handle the case that the `rules` is empty. 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to