XL/Multipart: Cleanup uploads.json after abort-multipart-upload. (#1678)

Fixes #1663
This commit is contained in:
Krishna Srinivas 2016-05-19 02:00:58 +05:30 committed by Harshavardhana
parent b69a97aed4
commit 71b9341fc7

View File

@ -237,7 +237,25 @@ func abortMultipartUploadCommon(storage StorageAPI, bucket, object, uploadID str
if !isUploadIDExists(storage, bucket, object, uploadID) {
return InvalidUploadID{UploadID: uploadID}
}
return cleanupUploadedParts(storage, bucket, object, uploadID)
if err := cleanupUploadedParts(storage, bucket, object, uploadID); err != nil {
return err
}
// Validate if there are other incomplete upload-id's present for
// the object, if yes do not attempt to delete 'uploads.json'.
if entries, err := storage.ListDir(minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object)); err == nil {
if len(entries) > 1 {
return nil
}
}
uploadsJSONPath := path.Join(mpartMetaPrefix, bucket, object, uploadsJSONFile)
if err := storage.DeleteFile(minioMetaBucket, uploadsJSONPath); err != nil {
return err
}
return nil
}
// isIncompleteMultipart - is object incomplete multipart.