wirybeaver commented on code in PR #10758:
URL: https://github.com/apache/pinot/pull/10758#discussion_r1214726972


##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java:
##########
@@ -884,6 +865,45 @@ public SuccessResponse deleteSegments(
     }
   }
 
+  @DELETE
+  @Consumes(MediaType.APPLICATION_JSON)
+  @Produces(MediaType.APPLICATION_JSON)
+  @Path("/segments/{tableName}/select")
+  @Authenticate(AccessType.DELETE)
+  @ApiOperation(value = "Delete select segments. An optional 
'excludeReplacedSegments' parameter is used to get the"
+      + " list of segments which has not yet been replaced (determined by 
segment lineage entries) and can be queried"
+      + " from the table. The value is false by default.",
+      // TODO: more and more filters can be added later on, like 
excludeErrorSegments, excludeConsumingSegments, etc.
+      notes = "List all segments")
+  public SuccessResponse deleteSegmentsWithTimeWindow(
+      @ApiParam(value = "Name of the table", required = true) 
@PathParam("tableName") String tableName,
+      @ApiParam(value = "OFFLINE|REALTIME") @QueryParam("type") String 
tableTypeStr,
+      @ApiParam(value = "Whether to keep replaced segments, which have been 
replaced"
+          + " specified in the segment lineage entries and cannot be queried 
from the table, false by default")
+      @QueryParam("excludeReplacedSegments") @DefaultValue("false") boolean 
excludeReplacedSegments,
+      @ApiParam(value = "Start timestamp (inclusive)") 
@QueryParam("startTimestamp") @DefaultValue("")
+          String startTimestampStr,
+      @ApiParam(value = "End timestamp (exclusive)") 
@QueryParam("endTimestamp") @DefaultValue("")
+          String endTimestampStr,
+      @ApiParam(value = "Whether to keep segments overlapping with the [start, 
end) from deletion, true by default")
+      @QueryParam("excludeOverlapping") @DefaultValue("true") boolean 
excludeOverlapping,
+      @ApiParam(value = "Retention period for the table segments (e.g. 12h, 
3d); If not set, the retention period "
+          + "will default to the first config that's not null: the table 
config, then to cluster setting, then '7d'. "
+          + "Using 0d or -1d will instantly delete segments without retention")
+      @QueryParam("retention") String retentionPeriod) {
+    int numSegments = 0;
+    for(Pair<TableType, List<String>> tableTypeSegments : 
selectSegments(tableName, tableTypeStr, excludeReplacedSegments, 
startTimestampStr, endTimestampStr, excludeOverlapping)) {
+      List<String> segments = tableTypeSegments.getValue();
+      numSegments += segments.size();
+      if(segments.isEmpty()) {
+        continue;
+      }
+      String tableNameWithType = getExistingTable(tableName, segments.get(0));

Review Comment:
   Thanks for pointing out the helix will be called. Fix with TableNameBuilder.



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

To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to