georgew5656 commented on code in PR #15770:
URL: https://github.com/apache/druid/pull/15770#discussion_r1471672990


##########
extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/AzureDataSegmentKiller.java:
##########
@@ -63,6 +69,79 @@ public AzureDataSegmentKiller(
     this.azureCloudBlobIterableFactory = azureCloudBlobIterableFactory;
   }
 
+  @Override
+  public void kill(List<DataSegment> segments) throws SegmentLoadingException
+  {
+    if (segments.isEmpty()) {
+      return;
+    }
+    if (segments.size() == 1) {
+      kill(segments.get(0));
+      return;
+    }
+
+    // create a list of keys to delete
+    Map<String, List<String>> containerToKeysToDelete = new HashMap<>();
+    for (DataSegment segment : segments) {
+      Map<String, Object> loadSpec = segment.getLoadSpec();
+      final String containerName = MapUtils.getString(loadSpec, 
"containerName");
+      final String blobPath = MapUtils.getString(loadSpec, "blobPath");
+      List<String> keysToDelete = containerToKeysToDelete.computeIfAbsent(
+          containerName,
+          k -> new ArrayList<>()
+      );
+      keysToDelete.add(blobPath);
+    }
+
+    boolean shouldThrowException = false;
+    for (Map.Entry<String, List<String>> containerToKeys : 
containerToKeysToDelete.entrySet()) {
+      shouldThrowException = deleteBlobKeys(containerToKeys.getValue(), 
containerToKeys.getKey());

Review Comment:
   i don't see why this wouldn't work, this will still try to delete blobs in 
all the containers, but the logic in S3DataSegmentKiller is maybe more clear



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

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to