From 5f679d9d1e57200d6e1287e1b57270c4920cc2e0 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Fri, 27 May 2016 10:42:45 +0530 Subject: [PATCH] Rename back multipart objects if read/write Quorum was unavailable (#1773) --- xl-v1-object.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/xl-v1-object.go b/xl-v1-object.go index ac242a294..d6421f072 100644 --- a/xl-v1-object.go +++ b/xl-v1-object.go @@ -180,7 +180,19 @@ func (xl xlObjects) renameObject(srcBucket, srcObject, dstBucket, dstObject stri if errCount <= len(xl.storageDisks)-xl.readQuorum { return nil } - xl.deleteObject(srcBucket, srcObject) + // Rename back the object on disks where RenameFile succeeded + for index, disk := range xl.storageDisks { + // Rename back the object in parallel to reduce overall disk latency + wg.Add(1) + go func(index int, disk StorageAPI) { + defer wg.Done() + if errs[index] != nil { + return + } + _ = disk.RenameFile(dstBucket, retainSlash(dstObject), srcBucket, retainSlash(srcObject)) + }(index, disk) + } + wg.Wait() return errWriteQuorum } return nil