Rename back multipart objects if read/write Quorum was unavailable (#1773)

master
Krishnan Parthasarathi 9 years ago committed by Harshavardhana
parent 51bb613fdf
commit 5f679d9d1e
  1. 14
      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

Loading…
Cancel
Save