Skip to content
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

InvalidPartOrder error on complete #33

Closed
dana-katzenelson-livongo opened this issue Jan 28, 2021 · 3 comments
Closed

InvalidPartOrder error on complete #33

dana-katzenelson-livongo opened this issue Jan 28, 2021 · 3 comments

Comments

@dana-katzenelson-livongo
Copy link
Contributor

I get the following error when using this API with smaller strings written:

Aborting [Manager uploading to $LOCATION with id $ID] due to error: com.amazonaws.services.s3.model.AmazonS3Exception: The list of parts was not in ascending order. Parts must be ordered by part number. (Service: Amazon S3; Status Code: 400; Error Code: InvalidPartOrder; Request ID: $REQ_ID; S3 Extended Request ID: $EXT_REQ_ID; Proxy: null), S3 Extended Request ID: $EXT_REQ_ID

According to Amazon Documentation (https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/S3/MS3CompleteMultipartUploadCompleteMultipartUploadRequest.html)

Error code: InvalidPartOrder

Description: The list of parts was not in ascending order. The parts list must be specified in order by part number.

400 Bad Request

Can you maybe sort StreamTransferManager.partETags by PartETag.partNumber before passing it into CompleteMultipartUploadRequest()?

@alexmojaki
Copy link
Owner

Hi, thanks for the error report!

I've never seen this error before, I wonder if it's a new requirement from AWS?

This should be easy to solve. Here is all the relevant code:

CompleteMultipartUploadRequest completeRequest = new
CompleteMultipartUploadRequest(
bucketName,
putKey,
uploadId,
partETags);
customiseCompleteRequest(completeRequest);
CompleteMultipartUploadResult completeMultipartUploadResult = s3Client.completeMultipartUpload(completeRequest);
if (checkIntegrity) {
checkCompleteFileIntegrity(completeMultipartUploadResult.getETag());
}
}
log.info("{}: Completed", this);
} catch (IntegrityCheckException e) {
// Nothing to abort. Upload has already finished.
throw e;
} catch (Throwable e) {
throw abort(e);
}
}
private void checkCompleteFileIntegrity(String s3ObjectETag) {
List<PartETag> parts = new ArrayList<PartETag>(partETags);
Collections.sort(parts, new PartNumberComparator());

Particularly important are lines 386, 390, and 404. The parts are already sorted for a different reason, we can just rearrange that.

Could you make a PR?

@dana-katzenelson-livongo
Copy link
Contributor Author

I made one at #34 before seeing this

@dana-katzenelson-livongo
Copy link
Contributor Author

Updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants