|
63 | 63 | import com.amazonaws.services.s3.model.KMSEncryptionMaterialsProvider; |
64 | 64 | import com.amazonaws.services.s3.model.ListObjectsV2Request; |
65 | 65 | import com.amazonaws.services.s3.model.ListObjectsV2Result; |
| 66 | +import com.amazonaws.services.s3.model.MultiObjectDeleteException; |
66 | 67 | import com.amazonaws.services.s3.model.ObjectMetadata; |
67 | 68 | import com.amazonaws.services.s3.model.PartETag; |
68 | 69 | import com.amazonaws.services.s3.model.PutObjectRequest; |
|
182 | 183 | import static java.util.Objects.requireNonNull; |
183 | 184 | import static java.util.concurrent.Executors.newCachedThreadPool; |
184 | 185 | import static java.util.concurrent.TimeUnit.SECONDS; |
| 186 | +import static java.util.stream.Collectors.joining; |
185 | 187 | import static java.util.stream.Collectors.toList; |
186 | 188 | import static org.apache.hadoop.fs.FSExceptionMessages.CANNOT_SEEK_PAST_EOF; |
187 | 189 | import static org.apache.hadoop.fs.FSExceptionMessages.NEGATIVE_SEEK; |
@@ -778,6 +780,12 @@ public void deleteFiles(Collection<Path> paths) |
778 | 780 | deletePaths(currentBatch); |
779 | 781 | } |
780 | 782 | } |
| 783 | + catch (MultiObjectDeleteException e) { |
| 784 | + String errors = e.getErrors().stream() |
| 785 | + .map(error -> format("key: %s, versionId: %s, code: %s, message: %s", error.getKey(), error.getVersionId(), error.getCode(), error.getMessage())) |
| 786 | + .collect(joining(", ")); |
| 787 | + throw new IOException("Exception while batch deleting paths: %s".formatted(errors), e); |
| 788 | + } |
781 | 789 | catch (AmazonClientException e) { |
782 | 790 | throw new IOException("Exception while batch deleting paths", e); |
783 | 791 | } |
|
0 commit comments