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/04/22 20:29:30 UTC

[GitHub] [incubator-druid] gianm commented on a change in pull request #7494: API to drop data by interval

gianm commented on a change in pull request #7494: API to drop data by interval
URL: https://github.com/apache/incubator-druid/pull/7494#discussion_r277424803
 
 

 ##########
 File path: server/src/main/java/org/apache/druid/metadata/SQLMetadataSegmentManager.java
 ##########
 @@ -407,6 +407,55 @@ public boolean removeSegment(SegmentId segmentId)
     }
   }
 
+  @Override
+  public boolean disableSegments(String dataSource, Collection<String> segmentIds)
+  {
+    if (segmentIds.isEmpty()) {
+      return false;
+    }
+    try {
+      connector.getDBI().withHandle(handle -> {
+        Batch batch = handle.createBatch();
+        segmentIds
+            .forEach(segmentId -> batch.add(
+                StringUtils.format(
+                    "UPDATE %s SET used=false WHERE id = '%s'",
+                    getSegmentsTable(),
+                    segmentId
+                )
+            ));
+        return batch.execute();
 
 Review comment:
   @jon-wei @surekhasaharan - since we're talking about design level stuff now, let's please focus on that before going back to code level comments. When it's sorted out could you update please take this discussion to https://github.com/apache/incubator-druid/issues/7439, and flesh out the proposal to include what the the response entails? Let's try to keep the PR focused on code level things.
   
   My 2ยข is that the response format should be the same regardless of whether you're doing by interval or by segment (for consistency's sake, so if people switch from one to the other they don't get surprised). And probably it's fine to just return the number of segments that had their status changed.
   
   If a user specifies some specific segments that don't exist, I'd be inclined to error out the entire call. But am not 100% tied to this.

----------------------------------------------------------------
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:
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