public final class MultiObjectDeleteSupport extends AbstractStoreOperation
Modifier and Type | Field and Description |
---|---|
static String |
ACCESS_DENIED
This is the exception exit code if access was denied on a delete.
|
Constructor and Description |
---|
MultiObjectDeleteSupport(StoreContext context,
BulkOperationState operationState)
Initiate with a store context.
|
Modifier and Type | Method and Description |
---|---|
static List<org.apache.hadoop.fs.Path> |
convertToPaths(Collection<com.amazonaws.services.s3.model.DeleteObjectsRequest.KeyVersion> keysToDelete,
Function<String,org.apache.hadoop.fs.Path> qualifier)
Given a list of delete requests, convert them all to paths.
|
static List<org.apache.hadoop.fs.Path> |
extractUndeletedPaths(com.amazonaws.services.s3.model.MultiObjectDeleteException deleteException,
Function<String,org.apache.hadoop.fs.Path> qualifierFn)
Build a list of undeleted paths from a
MultiObjectDeleteException . |
List<org.apache.hadoop.fs.Path> |
keysToPaths(Collection<com.amazonaws.services.s3.model.DeleteObjectsRequest.KeyVersion> keysToDelete)
Given a list of delete requests, convert them all to paths.
|
org.apache.commons.lang3.tuple.Triple<List<org.apache.hadoop.fs.Path>,List<org.apache.hadoop.fs.Path>,List<org.apache.commons.lang3.tuple.Pair<org.apache.hadoop.fs.Path,IOException>>> |
processDeleteFailure(com.amazonaws.services.s3.model.MultiObjectDeleteException deleteException,
List<com.amazonaws.services.s3.model.DeleteObjectsRequest.KeyVersion> keysToDelete)
Process a delete failure by removing from the metastore all entries
which where deleted, as inferred from the delete failures exception
and the original list of files to delete declares to have been deleted.
|
List<org.apache.hadoop.fs.Path> |
processDeleteFailureGenericException(Exception ex,
List<com.amazonaws.services.s3.model.DeleteObjectsRequest.KeyVersion> keysToDelete)
A delete operation failed.
|
org.apache.commons.lang3.tuple.Pair<List<org.apache.hadoop.fs.Path>,List<org.apache.hadoop.fs.Path>> |
splitUndeletedKeys(com.amazonaws.services.s3.model.MultiObjectDeleteException deleteException,
Collection<com.amazonaws.services.s3.model.DeleteObjectsRequest.KeyVersion> keysToDelete)
Process a multi object delete exception by building two paths from
the delete request: one of all deleted files, one of all undeleted values.
|
static IOException |
translateDeleteException(String message,
com.amazonaws.services.s3.model.MultiObjectDeleteException deleteException)
A
MultiObjectDeleteException is raised if one or more
paths listed in a bulk DELETE operation failed. |
getStoreContext
public static final String ACCESS_DENIED
public MultiObjectDeleteSupport(StoreContext context, BulkOperationState operationState)
context
- store context.operationState
- any ongoing bulk operation.public static IOException translateDeleteException(String message, com.amazonaws.services.s3.model.MultiObjectDeleteException deleteException)
MultiObjectDeleteException
is raised if one or more
paths listed in a bulk DELETE operation failed.
The top-level exception is therefore just "something wasn't deleted",
but doesn't include the what or the why.
This translation will extract an AccessDeniedException if that's one of
the causes, otherwise grabs the status code and uses it in the
returned exception.message
- text for the exceptiondeleteException
- the delete exception. to translatepublic org.apache.commons.lang3.tuple.Pair<List<org.apache.hadoop.fs.Path>,List<org.apache.hadoop.fs.Path>> splitUndeletedKeys(com.amazonaws.services.s3.model.MultiObjectDeleteException deleteException, Collection<com.amazonaws.services.s3.model.DeleteObjectsRequest.KeyVersion> keysToDelete)
deleteException
- the delete exception.keysToDelete
- the keys in the delete requestpublic List<org.apache.hadoop.fs.Path> keysToPaths(Collection<com.amazonaws.services.s3.model.DeleteObjectsRequest.KeyVersion> keysToDelete)
keysToDelete
- list of keys for the delete operation.public static List<org.apache.hadoop.fs.Path> convertToPaths(Collection<com.amazonaws.services.s3.model.DeleteObjectsRequest.KeyVersion> keysToDelete, Function<String,org.apache.hadoop.fs.Path> qualifier)
keysToDelete
- list of keys for the delete operation.qualifier
- path qualifierpublic org.apache.commons.lang3.tuple.Triple<List<org.apache.hadoop.fs.Path>,List<org.apache.hadoop.fs.Path>,List<org.apache.commons.lang3.tuple.Pair<org.apache.hadoop.fs.Path,IOException>>> processDeleteFailure(com.amazonaws.services.s3.model.MultiObjectDeleteException deleteException, List<com.amazonaws.services.s3.model.DeleteObjectsRequest.KeyVersion> keysToDelete)
deleteException
- the delete exception.keysToDelete
- collection of keys which had been requested.public static List<org.apache.hadoop.fs.Path> extractUndeletedPaths(com.amazonaws.services.s3.model.MultiObjectDeleteException deleteException, Function<String,org.apache.hadoop.fs.Path> qualifierFn)
MultiObjectDeleteException
.
Outside of unit tests, the qualifier function should be
S3AFileSystem.keyToQualifiedPath(String)
.deleteException
- the delete exception.qualifierFn
- function to qualify pathspublic List<org.apache.hadoop.fs.Path> processDeleteFailureGenericException(Exception ex, List<com.amazonaws.services.s3.model.DeleteObjectsRequest.KeyVersion> keysToDelete)
ex
- exception.keysToDelete
- the keys which were being deleted.Copyright © 2008–2020 Apache Software Foundation. All rights reserved.