HADOOP-18330. S3AFileSystem removes Path when calling createS3Client (#4572)
Adds a new parameter object in s3ClientCreationParameters that holds the full s3a path URI Contributed by Ashutosh Pant
This commit is contained in:
parent
d07256a96d
commit
bac2219e3c
@ -888,6 +888,7 @@ private void bindAWSClient(URI name, boolean dtEnabled) throws IOException {
|
|||||||
S3ClientFactory.S3ClientCreationParameters parameters = null;
|
S3ClientFactory.S3ClientCreationParameters parameters = null;
|
||||||
parameters = new S3ClientFactory.S3ClientCreationParameters()
|
parameters = new S3ClientFactory.S3ClientCreationParameters()
|
||||||
.withCredentialSet(credentials)
|
.withCredentialSet(credentials)
|
||||||
|
.withPathUri(name)
|
||||||
.withEndpoint(endpoint)
|
.withEndpoint(endpoint)
|
||||||
.withMetrics(statisticsContext.newStatisticsFromAwsSdk())
|
.withMetrics(statisticsContext.newStatisticsFromAwsSdk())
|
||||||
.withPathStyleAccess(conf.getBoolean(PATH_STYLE_ACCESS, false))
|
.withPathStyleAccess(conf.getBoolean(PATH_STYLE_ACCESS, false))
|
||||||
|
@ -115,6 +115,12 @@ final class S3ClientCreationParameters {
|
|||||||
*/
|
*/
|
||||||
private String userAgentSuffix = "";
|
private String userAgentSuffix = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* S3A path.
|
||||||
|
* added in HADOOP-18330
|
||||||
|
*/
|
||||||
|
private URI pathUri;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of request handlers to include in the chain
|
* List of request handlers to include in the chain
|
||||||
* of request execution in the SDK.
|
* of request execution in the SDK.
|
||||||
@ -264,5 +270,26 @@ public S3ClientCreationParameters withHeader(
|
|||||||
public Map<String, String> getHeaders() {
|
public Map<String, String> getHeaders() {
|
||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the full s3 path.
|
||||||
|
* added in HADOOP-18330
|
||||||
|
* @return path URI
|
||||||
|
*/
|
||||||
|
public URI getPathUri() {
|
||||||
|
return pathUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set full s3a path.
|
||||||
|
* added in HADOOP-18330
|
||||||
|
* @param value new value
|
||||||
|
* @return the builder
|
||||||
|
*/
|
||||||
|
public S3ClientCreationParameters withPathUri(
|
||||||
|
final URI value) {
|
||||||
|
pathUri = value;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,6 +176,7 @@ private AmazonS3 createS3Client(Configuration conf,
|
|||||||
S3ClientFactory.S3ClientCreationParameters parameters
|
S3ClientFactory.S3ClientCreationParameters parameters
|
||||||
= new S3ClientFactory.S3ClientCreationParameters()
|
= new S3ClientFactory.S3ClientCreationParameters()
|
||||||
.withCredentialSet(new AnonymousAWSCredentialsProvider())
|
.withCredentialSet(new AnonymousAWSCredentialsProvider())
|
||||||
|
.withPathUri(new URI("s3a://localhost/"))
|
||||||
.withEndpoint(endpoint)
|
.withEndpoint(endpoint)
|
||||||
.withMetrics(new EmptyS3AStatisticsContext()
|
.withMetrics(new EmptyS3AStatisticsContext()
|
||||||
.newStatisticsFromAwsSdk());
|
.newStatisticsFromAwsSdk());
|
||||||
|
@ -589,6 +589,7 @@ protected ObjectMetadata readLandsatMetadata(final S3AFileSystem delegatedFS)
|
|||||||
S3ClientFactory.S3ClientCreationParameters parameters = null;
|
S3ClientFactory.S3ClientCreationParameters parameters = null;
|
||||||
parameters = new S3ClientFactory.S3ClientCreationParameters()
|
parameters = new S3ClientFactory.S3ClientCreationParameters()
|
||||||
.withCredentialSet(testingCreds)
|
.withCredentialSet(testingCreds)
|
||||||
|
.withPathUri(new URI("s3a://localhost/"))
|
||||||
.withEndpoint(DEFAULT_ENDPOINT)
|
.withEndpoint(DEFAULT_ENDPOINT)
|
||||||
.withMetrics(new EmptyS3AStatisticsContext()
|
.withMetrics(new EmptyS3AStatisticsContext()
|
||||||
.newStatisticsFromAwsSdk())
|
.newStatisticsFromAwsSdk())
|
||||||
|
Loading…
Reference in New Issue
Block a user