suneet-s commented on code in PR #15770:
URL: https://github.com/apache/druid/pull/15770#discussion_r1470226600
##########
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:
Actually my suggested pattern may not work, because we want to call
`deleteBlobKeys` on every container, even if shouldThrowException is true. We
probably want to follow the pattern in S3DataSegmentKiller.
```
hadException = deleteBlobKeys(containerToKeys.getValue(),
containerToKeys.getKey());
if (hadException) {
shouldThrowException = true;
}
```
--
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]