9aman commented on code in PR #15996:
URL: https://github.com/apache/pinot/pull/15996#discussion_r2161254197


##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java:
##########
@@ -1246,15 +1250,45 @@ public SuccessResponse deleteSegmentsFromSequenceNum(
     Map<Integer, Set<String>> partitionIdToSegmentsToDeleteMap =
         getPartitionIdToSegmentsToDeleteMap(partitionToOldestSegment, 
idealStateSegmentsSet,
             partitionIdToLatestSegment);
+
+    Map<String, Object> response = new HashMap<>();
+    Map<String, Object> partitionDetails = new HashMap<>();
+
     for (Integer partitionID : partitionToOldestSegment.keySet()) {
       Set<String> segmentToDeleteForPartition = 
partitionIdToSegmentsToDeleteMap.get(partitionID);
-      LOGGER.info("Deleting : {} segments from segment: {} to segment: {} for 
partition: {}",
-          segmentToDeleteForPartition.size(), 
partitionToOldestSegment.get(partitionID),
-          partitionIdToLatestSegment.get(partitionID), partitionID);
-      deleteSegmentsInternal(tableNameWithType, new 
ArrayList<>(segmentToDeleteForPartition), null);
+      LLCSegmentName oldestSegment = partitionToOldestSegment.get(partitionID);
+      LLCSegmentName latestSegment = 
partitionIdToLatestSegment.get(partitionID);
+
+      Map<String, Object> partitionInfo = new HashMap<>();
+      partitionInfo.put("segmentsToDelete", new 
ArrayList<>(segmentToDeleteForPartition));
+      partitionInfo.put("smallestSegment", oldestSegment.getSegmentName());
+      partitionInfo.put("largestSegment", latestSegment.getSegmentName());
+      partitionInfo.put("segmentCount", segmentToDeleteForPartition.size());
+
+      partitionDetails.put("partition_" + partitionID, partitionInfo);
+
+      LOGGER.info("Partition {}: {} segments to delete from {} to {}",
+          partitionID, segmentToDeleteForPartition.size(),
+          oldestSegment.getSegmentName(), latestSegment.getSegmentName());
+
+      // Only perform actual deletion if dryRun is false
+      if (!dryRun) {
+        LOGGER.info("Deleting {} segments from segment: {} to segment: {} for 
partition: {}",

Review Comment:
   Done



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