HADOOP-17951. Improve S3A checking of S3 Access Point existence (#3516)
Follow-on to HADOOP-17198. Support S3 Access Points Contributed by Bogdan Stolojan Change-Id: I0932476c64e1967eb0cb3e0f00060fac5d2bae72
This commit is contained in:
parent
664075f35d
commit
a8d7acf1a8
|
@ -204,6 +204,7 @@ import static org.apache.hadoop.fs.s3a.impl.CallableSupplier.submit;
|
|||
import static org.apache.hadoop.fs.s3a.impl.CallableSupplier.waitForCompletionIgnoringExceptions;
|
||||
import static org.apache.hadoop.fs.s3a.impl.ErrorTranslation.isObjectNotFound;
|
||||
import static org.apache.hadoop.fs.s3a.impl.ErrorTranslation.isUnknownBucket;
|
||||
import static org.apache.hadoop.fs.s3a.impl.InternalConstants.AP_INACCESSIBLE;
|
||||
import static org.apache.hadoop.fs.s3a.impl.InternalConstants.AP_REQUIRED_EXCEPTION;
|
||||
import static org.apache.hadoop.fs.s3a.impl.InternalConstants.ARN_BUCKET_OPTION;
|
||||
import static org.apache.hadoop.fs.s3a.impl.InternalConstants.CSE_PADDING_LENGTH;
|
||||
|
@ -730,7 +731,8 @@ public class S3AFileSystem extends FileSystem implements StreamCapabilities,
|
|||
s3.getBucketAcl(bucket);
|
||||
} catch (AmazonServiceException ex) {
|
||||
int statusCode = ex.getStatusCode();
|
||||
if (statusCode == SC_404 || (statusCode == SC_403 && accessPoint != null)) {
|
||||
if (statusCode == SC_404 ||
|
||||
(statusCode == SC_403 && ex.getMessage().contains(AP_INACCESSIBLE))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,6 +143,11 @@ public final class InternalConstants {
|
|||
public static final String AP_REQUIRED_EXCEPTION = "Access Points usage is required" +
|
||||
" but not configured for the bucket.";
|
||||
|
||||
/**
|
||||
* Error message to indicate Access Points are not accessible or don't exist.
|
||||
*/
|
||||
public static final String AP_INACCESSIBLE = "Could not access through this access point";
|
||||
|
||||
/**
|
||||
* AccessPoint ARN for the bucket. When set as a bucket override the requests for that bucket
|
||||
* will go through the AccessPoint.
|
||||
|
|
Loading…
Reference in New Issue