mirror of
https://github.com/minio/minio.git
synced 2025-01-12 07:23:23 -05:00
XL: Make sure to create proper temporary files for renames to succeed. (#1654)
Renames work in a special manner, temporary location files should be created properly. Fixes #1653 Fixes #1651
This commit is contained in:
parent
9472299308
commit
1760687c83
@ -39,7 +39,8 @@ const (
|
|||||||
func createUploadsJSON(storage StorageAPI, bucket, object, uploadID string) error {
|
func createUploadsJSON(storage StorageAPI, bucket, object, uploadID string) error {
|
||||||
// Place holder uploads.json
|
// Place holder uploads.json
|
||||||
uploadsPath := path.Join(mpartMetaPrefix, bucket, object, uploadsJSONFile)
|
uploadsPath := path.Join(mpartMetaPrefix, bucket, object, uploadsJSONFile)
|
||||||
tmpUploadsPath := path.Join(tmpMetaPrefix, bucket, object, uploadID, uploadsJSONFile)
|
uploadsJSONSuffix := fmt.Sprintf("%s.%s", uploadID, uploadsJSONFile)
|
||||||
|
tmpUploadsPath := path.Join(tmpMetaPrefix, bucket, object, uploadsJSONSuffix)
|
||||||
w, err := storage.CreateFile(minioMetaBucket, uploadsPath)
|
w, err := storage.CreateFile(minioMetaBucket, uploadsPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -98,7 +99,8 @@ func newMultipartUploadCommon(storage StorageAPI, bucket string, object string)
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
uploadIDPath := path.Join(mpartMetaPrefix, bucket, object, uploadID, incompleteFile)
|
uploadIDPath := path.Join(mpartMetaPrefix, bucket, object, uploadID, incompleteFile)
|
||||||
tempUploadIDPath := path.Join(tmpMetaPrefix, bucket, object, uploadID, incompleteFile)
|
incompleteSuffix := fmt.Sprintf("%s.%s", uploadID, incompleteFile)
|
||||||
|
tempUploadIDPath := path.Join(tmpMetaPrefix, bucket, object, incompleteSuffix)
|
||||||
if _, err = storage.StatFile(minioMetaBucket, uploadIDPath); err != nil {
|
if _, err = storage.StatFile(minioMetaBucket, uploadIDPath); err != nil {
|
||||||
if err != errFileNotFound {
|
if err != errFileNotFound {
|
||||||
return "", toObjectErr(err, minioMetaBucket, uploadIDPath)
|
return "", toObjectErr(err, minioMetaBucket, uploadIDPath)
|
||||||
|
@ -183,7 +183,8 @@ func (xl xlObjects) CompleteMultipartUpload(bucket string, object string, upload
|
|||||||
metadata.ModTime = time.Now().UTC()
|
metadata.ModTime = time.Now().UTC()
|
||||||
|
|
||||||
// Create temporary multipart meta file to write and then rename.
|
// Create temporary multipart meta file to write and then rename.
|
||||||
tempMultipartMetaFile := path.Join(tmpMetaPrefix, bucket, object, uploadID, multipartMetaFile)
|
multipartMetaSuffix := fmt.Sprintf("%s.%s", uploadID, multipartMetaFile)
|
||||||
|
tempMultipartMetaFile := path.Join(tmpMetaPrefix, bucket, object, multipartMetaSuffix)
|
||||||
w, err := xl.storage.CreateFile(minioMetaBucket, tempMultipartMetaFile)
|
w, err := xl.storage.CreateFile(minioMetaBucket, tempMultipartMetaFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", toObjectErr(err, bucket, object)
|
return "", toObjectErr(err, bucket, object)
|
||||||
|
Loading…
Reference in New Issue
Block a user