|
|
|
@ -617,7 +617,7 @@ func (xl xlObjects) CompleteMultipartUpload(bucket string, object string, upload |
|
|
|
|
return "", toObjectErr(errXLWriteQuorum, bucket, object) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_, modTime := listOnlineDisks(xl.storageDisks, partsMetadata, errs) |
|
|
|
|
onlineDisks, modTime := listOnlineDisks(xl.storageDisks, partsMetadata, errs) |
|
|
|
|
|
|
|
|
|
// Calculate full object size.
|
|
|
|
|
var objectSize int64 |
|
|
|
@ -625,6 +625,12 @@ func (xl xlObjects) CompleteMultipartUpload(bucket string, object string, upload |
|
|
|
|
// Pick one from the first valid metadata.
|
|
|
|
|
xlMeta := pickValidXLMeta(partsMetadata, modTime) |
|
|
|
|
|
|
|
|
|
// Order online disks in accordance with distribution order.
|
|
|
|
|
onlineDisks = getOrderedDisks(xlMeta.Erasure.Distribution, onlineDisks) |
|
|
|
|
|
|
|
|
|
// Order parts metadata in accordance with distribution order.
|
|
|
|
|
partsMetadata = getOrderedPartsMetadata(xlMeta.Erasure.Distribution, partsMetadata) |
|
|
|
|
|
|
|
|
|
// Save current xl meta for validation.
|
|
|
|
|
var currentXLMeta = xlMeta |
|
|
|
|
|
|
|
|
@ -695,10 +701,10 @@ func (xl xlObjects) CompleteMultipartUpload(bucket string, object string, upload |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Write unique `xl.json` for each disk.
|
|
|
|
|
if err = writeUniqueXLMetadata(xl.storageDisks, minioMetaBucket, tempUploadIDPath, partsMetadata, xl.writeQuorum); err != nil { |
|
|
|
|
if err = writeUniqueXLMetadata(onlineDisks, minioMetaBucket, tempUploadIDPath, partsMetadata, xl.writeQuorum); err != nil { |
|
|
|
|
return "", toObjectErr(err, minioMetaBucket, tempUploadIDPath) |
|
|
|
|
} |
|
|
|
|
rErr := commitXLMetadata(xl.storageDisks, tempUploadIDPath, uploadIDPath, xl.writeQuorum) |
|
|
|
|
rErr := commitXLMetadata(onlineDisks, tempUploadIDPath, uploadIDPath, xl.writeQuorum) |
|
|
|
|
if rErr != nil { |
|
|
|
|
return "", toObjectErr(rErr, minioMetaBucket, uploadIDPath) |
|
|
|
|
} |
|
|
|
@ -721,6 +727,9 @@ func (xl xlObjects) CompleteMultipartUpload(bucket string, object string, upload |
|
|
|
|
// Rename if an object already exists to temporary location.
|
|
|
|
|
uniqueID := getUUID() |
|
|
|
|
if xl.isObject(bucket, object) { |
|
|
|
|
// NOTE: Do not use online disks slice here.
|
|
|
|
|
// The reason is that existing object should be purged
|
|
|
|
|
// regardless of `xl.json` status and rolled back in case of errors.
|
|
|
|
|
err = renameObject(xl.storageDisks, bucket, object, minioMetaBucket, path.Join(tmpMetaPrefix, uniqueID), xl.writeQuorum) |
|
|
|
|
if err != nil { |
|
|
|
|
return "", toObjectErr(err, bucket, object) |
|
|
|
@ -741,7 +750,7 @@ func (xl xlObjects) CompleteMultipartUpload(bucket string, object string, upload |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Rename the multipart object to final location.
|
|
|
|
|
if err = renameObject(xl.storageDisks, minioMetaBucket, uploadIDPath, bucket, object, xl.writeQuorum); err != nil { |
|
|
|
|
if err = renameObject(onlineDisks, minioMetaBucket, uploadIDPath, bucket, object, xl.writeQuorum); err != nil { |
|
|
|
|
return "", toObjectErr(err, bucket, object) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|