XL: explicit deleteObject is not needed after rename failure. (#1760)

Reason is renameObject() does deleteObject() upon writeQuorum
failure if not keeps the successfully renamed parts if we have
reached readQuorum.
master
Harshavardhana 9 years ago committed by Harshavardhana
parent 3550660163
commit cae4782973
  1. 6
      xl-v1-multipart.go
  2. 10
      xl-v1-object.go

@ -88,9 +88,6 @@ func (xl xlObjects) newMultipartUploadCommon(bucket string, object string, meta
} }
rErr := xl.renameObject(minioMetaBucket, tempUploadIDPath, minioMetaBucket, uploadIDPath) rErr := xl.renameObject(minioMetaBucket, tempUploadIDPath, minioMetaBucket, uploadIDPath)
if rErr == nil { if rErr == nil {
if dErr := xl.deleteObject(minioMetaBucket, tempUploadIDPath); dErr != nil {
return "", toObjectErr(dErr, minioMetaBucket, tempUploadIDPath)
}
// Return success. // Return success.
return uploadID, nil return uploadID, nil
} }
@ -194,9 +191,6 @@ func (xl xlObjects) putObjectPartCommon(bucket string, object string, uploadID s
partPath := path.Join(mpartMetaPrefix, bucket, object, uploadID, partSuffix) partPath := path.Join(mpartMetaPrefix, bucket, object, uploadID, partSuffix)
err = xl.renameObject(minioMetaBucket, tmpPartPath, minioMetaBucket, partPath) err = xl.renameObject(minioMetaBucket, tmpPartPath, minioMetaBucket, partPath)
if err != nil { if err != nil {
if dErr := xl.deleteObject(minioMetaBucket, tmpPartPath); dErr != nil {
return "", toObjectErr(dErr, minioMetaBucket, tmpPartPath)
}
return "", toObjectErr(err, minioMetaBucket, partPath) return "", toObjectErr(err, minioMetaBucket, partPath)
} }
if err = xl.writeXLMetadata(minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object, uploadID), xlMeta); err != nil { if err = xl.writeXLMetadata(minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object, uploadID), xlMeta); err != nil {

@ -269,9 +269,6 @@ func (xl xlObjects) PutObject(bucket string, object string, size int64, data io.
err = xl.renameObject(minioMetaBucket, tempObj, bucket, object) err = xl.renameObject(minioMetaBucket, tempObj, bucket, object)
if err != nil { if err != nil {
if dErr := xl.deleteObject(minioMetaBucket, tempObj); dErr != nil {
return "", toObjectErr(dErr, minioMetaBucket, tempObj)
}
return "", toObjectErr(err, bucket, object) return "", toObjectErr(err, bucket, object)
} }
@ -300,7 +297,12 @@ func (xl xlObjects) deleteObject(bucket, object string) error {
wg.Add(1) wg.Add(1)
go func(index int, disk StorageAPI) { go func(index int, disk StorageAPI) {
defer wg.Done() defer wg.Done()
dErrs[index] = cleanupDir(disk, bucket, object) err := cleanupDir(disk, bucket, object)
if err != nil {
dErrs[index] = err
return
}
dErrs[index] = nil
}(index, disk) }(index, disk)
} }

Loading…
Cancel
Save