caishunfeng commented on code in PR #12076:
URL:
https://github.com/apache/dolphinscheduler/pull/12076#discussion_r1005196240
##########
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/storage/impl/S3Utils.java:
##########
@@ -206,21 +238,38 @@ public void download(String tenantCode, String
srcFilePath, String dstFilePath,
}
@Override
- public boolean exists(String tenantCode, String fileName) throws
IOException {
- return s3Client.doesObjectExist(BUCKET_NAME, fileName);
+ public boolean exists(String fullName) throws IOException {
+ return s3Client.doesObjectExist(BUCKET_NAME, fullName);
}
@Override
- public boolean delete(String tenantCode, String filePath, boolean
recursive) throws IOException {
+ public boolean delete(String fullName, boolean recursive) throws
IOException {
try {
- s3Client.deleteObject(BUCKET_NAME, filePath);
+ s3Client.deleteObject(BUCKET_NAME, fullName);
return true;
} catch (AmazonServiceException e) {
- logger.error("delete the object error,the resource path is {}",
filePath);
+ logger.error("delete the object error,the resource path is {}",
fullName);
return false;
}
}
+ @Override
+ public boolean delete(String fullName, List<String> childrenPathList,
boolean recursive) throws IOException {
+ // append the resource fullName to the list for deletion.
+ childrenPathList.add(fullName);
+
+ DeleteObjectsRequest deleteObjectsRequest = new
DeleteObjectsRequest(BUCKET_NAME)
+ .withKeys(childrenPathList.stream().toArray(String[]::new));
+ try {
+ s3Client.deleteObjects(deleteObjectsRequest);
+ } catch (AmazonServiceException e) {
+ logger.error(e.getMessage());
Review Comment:
```suggestion
logger.error("delete objects error", e);
```
--
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]