How to properly and completely terminate a multipart upload?

0

In our Java app we have what is basically boilerplate S3 V2 code for creating a multipart upload of a file to S3. We absolutely need the ability to cancel the upload, and recover all resources used by the upload process, INCLUDING the CPU and network bandwidth. Initially we tried simply cancelling the completionFuture on the FileUpload, but that doesn't work. I can watch the network traffic continue to send data to S3, until the entire file is uploaded. Cancelling the completionFuture seems to stop S3 from reconstructing the file, but that's not sufficient. In most cases we need to cancel the upload because we need the network bandwidth for other things, like streaming video.

I found the function shutdownNow() in the TransferManager class, and that seemed promising, but it looks like it's not available in the V2 SDK (I found it in the V1 sources).

I've seen a function getSubTransfers() in the V1 MultipleFileUpload class that returns a list of Uploads, and the Upload class has an abort() function, but again, we need to use V2 for other reasons.

I've also found and implemented code that calls listMultipartUploads, looks for the upload we want to cancel, creates an abortMultipartUploadRequest, issues it and the threads keep on rolling, and rolling, and rolling....

Is there a "correct" way of terminating a multipart upload, including the threads processing the upload?

demandé il y a 2 ans284 vues
1 réponse
0

Hello,

The TransferManager class contains an abortMultipartUploads method that would allow you to halt multiple multipart uploads in progress. To abort a specific multipart upload, you’ll need to use a lower-level API called abortMultipartUpload under the S3 client class. This method would delete any parts uploaded to Amazon S3 and free up the associated resources, given the upload ID, bucket name, and object key.

The reference page below contains instructions and example code in Java and .NET for aborting a multipart upload:

https://docs.aws.amazon.com/AmazonS3/latest/userguide/abort-mpu.html

répondu il y a 9 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions