-
Notifications
You must be signed in to change notification settings - Fork 859
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
Fix for issue #4720 , Cross Region enabled Clients created in US-EAST-1 will by internally disable global endpoint and do a regional endpoint call. #4849
Changes from 1 commit
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"type": "bugfix", | ||
"category": "Amazon Simple Storage Service", | ||
"contributor": "", | ||
"description": "Fix for issue [#4720](https://github.com/aws/aws-sdk-java-v2/issues/4720) , Cross Region enabled Clients created in US-EAST-1 will by internally disable global endpoint and do a regional endpoint call." | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,23 +52,17 @@ protected <T extends S3Request, ReturnT> CompletableFuture<ReturnT> invokeOperat | |
|
||
AwsRequestOverrideConfiguration overrideConfiguration = updateUserAgentInConfig(request); | ||
T userAgentUpdatedRequest = (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build(); | ||
|
||
if (!bucket.isPresent()) { | ||
return operation.apply(userAgentUpdatedRequest); | ||
} | ||
String bucketName = bucket.get(); | ||
|
||
CompletableFuture<ReturnT> returnFuture = new CompletableFuture<>(); | ||
CompletableFuture<ReturnT> apiOperationFuture = bucketToRegionCache.containsKey(bucketName) ? | ||
operation.apply( | ||
requestWithDecoratedEndpointProvider( | ||
userAgentUpdatedRequest, | ||
() -> bucketToRegionCache.get(bucketName), | ||
serviceClientConfiguration().endpointProvider().get() | ||
) | ||
) : | ||
operation.apply(userAgentUpdatedRequest); | ||
|
||
CompletableFuture<ReturnT> apiOperationFuture = operation.apply( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we removing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Earlier, for the first calls, since CachedBucket was null, we used to skip overriding the EndpointProvider because we were making the calls as they were. Now, since we need to update the 'useGlobalEndpoint' even for the first call, we need to override the EndpointProvider |
||
requestWithDecoratedEndpointProvider(userAgentUpdatedRequest, | ||
() -> bucketToRegionCache.get(bucketName), | ||
serviceClientConfiguration().endpointProvider().get()) | ||
); | ||
apiOperationFuture.whenComplete(redirectToCrossRegionIfRedirectException(operation, | ||
userAgentUpdatedRequest, | ||
bucketName, | ||
|
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.
Nit, suggestion:
"S3 client configured with
crossRegionEnabled(true)
will now useus-east-1
regional endpoint instead of the global endpoint. See #4720"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.
Thanks Zoe