-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HADOOP-19286: S3A: Support cross region access when S3 region/endpoint is set #7067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
1c2e59c
f5f0bc5
2c541df
1f41548
d3a4e61
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,6 +46,7 @@ | |
|
|
||
| import static org.apache.hadoop.fs.s3a.Constants.ALLOW_REQUESTER_PAYS; | ||
| import static org.apache.hadoop.fs.s3a.Constants.AWS_REGION; | ||
| import static org.apache.hadoop.fs.s3a.Constants.AWS_S3_CROSS_REGION_ACCESS_ENABLED; | ||
| import static org.apache.hadoop.fs.s3a.Constants.CENTRAL_ENDPOINT; | ||
| import static org.apache.hadoop.fs.s3a.Constants.ENDPOINT; | ||
| import static org.apache.hadoop.fs.s3a.Constants.FIPS_ENDPOINT; | ||
|
|
@@ -346,6 +347,37 @@ public void testCentralEndpointAndDifferentRegionThanBucket() throws Throwable { | |
| assertRequesterPaysFileExistence(newConf); | ||
| } | ||
|
|
||
| @Test | ||
| public void testWithOutCrossRegionAccess() throws Exception { | ||
| describe("Verify cross region access fails when disabled"); | ||
| final Configuration newConf = new Configuration(getConfiguration()); | ||
| // skip the test if the region is eu-west-2 | ||
| String region = getFileSystem().getS3AInternals().getBucketMetadata().bucketRegion(); | ||
| if (EU_WEST_2.equals(region)) { | ||
| return; | ||
| } | ||
| // disable cross region access | ||
| newConf.setBoolean(AWS_S3_CROSS_REGION_ACCESS_ENABLED, false); | ||
| newConf.set(AWS_REGION, EU_WEST_2); | ||
| S3AFileSystem fs = new S3AFileSystem(); | ||
| fs.initialize(getFileSystem().getUri(), newConf); | ||
| intercept(AWSRedirectException.class, | ||
| "does not match the AWS region containing the bucket", | ||
| () -> fs.exists(getFileSystem().getWorkingDirectory())); | ||
| } | ||
|
|
||
| @Test | ||
| public void testWithCrossRegionAccess() throws Exception { | ||
| describe("Verify cross region access succeed when enabled"); | ||
| final Configuration newConf = new Configuration(getConfiguration()); | ||
steveloughran marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // enable cross region access | ||
| newConf.setBoolean(AWS_S3_CROSS_REGION_ACCESS_ENABLED, true); | ||
| newConf.set(AWS_REGION, EU_WEST_2); | ||
|
||
| S3AFileSystem fs = new S3AFileSystem(); | ||
|
||
| fs.initialize(getFileSystem().getUri(), newConf); | ||
| fs.exists(getFileSystem().getWorkingDirectory()); | ||
| } | ||
|
|
||
| @Test | ||
| public void testCentralEndpointAndSameRegionAsBucket() throws Throwable { | ||
| describe("Access public bucket using central endpoint and region " | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So as per the implementation, It looks like it won't be supported by thirdparty store and each store have to implement it separately.