-
Notifications
You must be signed in to change notification settings - Fork 915
Fixed the issue in S3 multipart client where the list of parts could … #4998
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
Conversation
@@ -94,7 +94,7 @@ public String uploadId() { | |||
} | |||
|
|||
public Map<Integer, CompletedPart> existingParts() { | |||
return existingParts != null ? Collections.unmodifiableMap(existingParts) : null; |
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.
I removed this since this seems a bit overkill for an internal API.
@@ -193,15 +199,16 @@ public void onComplete() { | |||
} | |||
|
|||
private void completeMultipartUploadIfFinished(int requestsInFlight) { | |||
if (isDone && requestsInFlight == 0) { | |||
if (isDone && requestsInFlight == 0 && completedMultipartInitiated.compareAndSet(false, true)) { |
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.
Added back this check. It was removed as part of the refactoring for some reason.
} else { | ||
parts = existingParts.values().toArray(new CompletedPart[0]); |
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.
This else block is not needed since mergeCompletedParts should handle it
…be out of order in the CompleteMultipartRequest, causing "The list of parts was not in ascending order" error to be thrown.
6b63903
to
60fa08d
Compare
|
…be out of order in the CompleteMultipartRequest, causing "The list of parts was not in ascending order" error to be thrown. (aws#4998)
…
Motivation and Context
Fixed the issue in S3 multipart client where the list of parts could be out of order in
CompleteMultipartRequest
, causingThe list of parts was not in ascending order
error to be thrown.This was a regression introduced in #4908. The root cause is that the type of
completedParts
was changed fromAtomicReferenceArray
toConcurrentHashMap
, which is not sorted when the SDK sends the request.Modifications
AtomicReferenceArray
since it should provide better performance than ConcurrentHashMapTesting
Added unit tests
Screenshots (if appropriate)
Types of changes
Checklist
mvn install
succeedsscripts/new-change
script and following the instructions. Commit the new file created by the script in.changes/next-release
with your changes.License