From cae47829733b2388a4e43cb6cd67e51fd73cf355 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 25 May 2016 14:32:49 -0700 Subject: [PATCH] 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. --- xl-v1-multipart.go | 6 ------ xl-v1-object.go | 10 ++++++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/xl-v1-multipart.go b/xl-v1-multipart.go index 1fca6e3f5..394957acc 100644 --- a/xl-v1-multipart.go +++ b/xl-v1-multipart.go @@ -88,9 +88,6 @@ func (xl xlObjects) newMultipartUploadCommon(bucket string, object string, meta } rErr := xl.renameObject(minioMetaBucket, tempUploadIDPath, minioMetaBucket, uploadIDPath) if rErr == nil { - if dErr := xl.deleteObject(minioMetaBucket, tempUploadIDPath); dErr != nil { - return "", toObjectErr(dErr, minioMetaBucket, tempUploadIDPath) - } // Return success. 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) err = xl.renameObject(minioMetaBucket, tmpPartPath, minioMetaBucket, partPath) if err != nil { - if dErr := xl.deleteObject(minioMetaBucket, tmpPartPath); dErr != nil { - return "", toObjectErr(dErr, minioMetaBucket, tmpPartPath) - } return "", toObjectErr(err, minioMetaBucket, partPath) } if err = xl.writeXLMetadata(minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object, uploadID), xlMeta); err != nil { diff --git a/xl-v1-object.go b/xl-v1-object.go index b069b2d61..6f10ad2f3 100644 --- a/xl-v1-object.go +++ b/xl-v1-object.go @@ -269,9 +269,6 @@ func (xl xlObjects) PutObject(bucket string, object string, size int64, data io. err = xl.renameObject(minioMetaBucket, tempObj, bucket, object) if err != nil { - if dErr := xl.deleteObject(minioMetaBucket, tempObj); dErr != nil { - return "", toObjectErr(dErr, minioMetaBucket, tempObj) - } return "", toObjectErr(err, bucket, object) } @@ -300,7 +297,12 @@ func (xl xlObjects) deleteObject(bucket, object string) error { wg.Add(1) go func(index int, disk StorageAPI) { 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) }