fs: Create object part with md5sum later using RenameFile. (#1440)

Fixes #1340.
master
Harshavardhana 9 years ago
parent 0c27d8e5b1
commit e05aa762a9
  1. 11
      fs-objects-multipart.go

@ -324,8 +324,9 @@ func (fs fsObjects) PutObjectPart(bucket, object, uploadID string, partID int, s
return "", InvalidUploadID{UploadID: uploadID} return "", InvalidUploadID{UploadID: uploadID}
} }
partSuffix := fmt.Sprintf("%s.%d.%s", uploadID, partID, md5Hex) partSuffix := fmt.Sprintf("%s.%d", uploadID, partID)
fileWriter, err := fs.storage.CreateFile(minioMetaVolume, path.Join(bucket, object, partSuffix)) partSuffixPath := path.Join(bucket, object, partSuffix)
fileWriter, err := fs.storage.CreateFile(minioMetaVolume, partSuffixPath)
if err != nil { if err != nil {
return "", toObjectErr(err, bucket, object) return "", toObjectErr(err, bucket, object)
} }
@ -367,6 +368,12 @@ func (fs fsObjects) PutObjectPart(bucket, object, uploadID string, partID int, s
if err != nil { if err != nil {
return "", err return "", err
} }
partSuffixMD5 := fmt.Sprintf("%s.%d.%s", uploadID, partID, newMD5Hex)
partSuffixMD5Path := path.Join(bucket, object, partSuffixMD5)
err = fs.storage.RenameFile(minioMetaVolume, partSuffixPath, minioMetaVolume, partSuffixMD5Path)
if err != nil {
return "", err
}
return newMD5Hex, nil return newMD5Hex, nil
} }

Loading…
Cancel
Save