From 6d84e84b3c870291c03bbb5e892b11e43fd68af1 Mon Sep 17 00:00:00 2001 From: Krishna Srinivas Date: Tue, 24 May 2016 20:45:46 +0530 Subject: [PATCH] XL/mutltipart: fix partnumber to partname association. (#1739) Fixes #1738 --- docs/backend/json-files/fs/fs.json | 2 +- docs/backend/json-files/xl/xl.json | 6 +++--- xl-v1-multipart.go | 4 ++-- xl-v1-object.go | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/backend/json-files/fs/fs.json b/docs/backend/json-files/fs/fs.json index 5d5594828..a2d4c967d 100644 --- a/docs/backend/json-files/fs/fs.json +++ b/docs/backend/json-files/fs/fs.json @@ -6,7 +6,7 @@ }, "parts": [ { - "name": "object1", + "name": "object00001", "size": 29, "eTag": "", }, diff --git a/docs/backend/json-files/xl/xl.json b/docs/backend/json-files/xl/xl.json index ebd73fa86..7699e2198 100644 --- a/docs/backend/json-files/xl/xl.json +++ b/docs/backend/json-files/xl/xl.json @@ -3,17 +3,17 @@ { "size": 5242880, "etag": "3565c6e741e69a007a5ac7db893a62b5", - "name": "object1" + "name": "object00001" }, { "size": 5242880, "etag": "d416712335c280ab1e39498552937764", - "name": "object2" + "name": "object00002" }, { "size": 4338324, "etag": "8a98c5c54d81c6c95ed9bdcaeb941aaf", - "name": "object3" + "name": "object00003" } ], "meta": { diff --git a/xl-v1-multipart.go b/xl-v1-multipart.go index 513c6bedf..14d503dc0 100644 --- a/xl-v1-multipart.go +++ b/xl-v1-multipart.go @@ -125,7 +125,7 @@ func (xl xlObjects) putObjectPartCommon(bucket string, object string, uploadID s nsMutex.Lock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object, uploadID, strconv.Itoa(partID))) defer nsMutex.Unlock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object, uploadID, strconv.Itoa(partID))) - partSuffix := fmt.Sprintf("object%d", partID) + partSuffix := fmt.Sprintf("object.%.5d", partID) tmpPartPath := path.Join(tmpMetaPrefix, bucket, object, uploadID, partSuffix) fileWriter, err := xl.erasureDisk.CreateFile(minioMetaBucket, tmpPartPath) if err != nil { @@ -318,7 +318,7 @@ func (xl xlObjects) CompleteMultipartUpload(bucket string, object string, upload // Loop through all parts, validate them and then commit to disk. for i, part := range parts { // Construct part suffix. - partSuffix := fmt.Sprintf("object%d", part.PartNumber) + partSuffix := fmt.Sprintf("object.%.5d", part.PartNumber) if xlMeta.SearchObjectPart(partSuffix, part.ETag) == -1 { return "", InvalidPart{} } diff --git a/xl-v1-object.go b/xl-v1-object.go index 9979087c1..b74a1bba4 100644 --- a/xl-v1-object.go +++ b/xl-v1-object.go @@ -191,7 +191,7 @@ func (xl xlObjects) PutObject(bucket string, object string, size int64, data io. nsMutex.Lock(bucket, object) defer nsMutex.Unlock(bucket, object) - tempErasureObj := path.Join(tmpMetaPrefix, bucket, object, "object1") + tempErasureObj := path.Join(tmpMetaPrefix, bucket, object, "object00001") tempObj := path.Join(tmpMetaPrefix, bucket, object) fileWriter, err := xl.erasureDisk.CreateFile(minioMetaBucket, tempErasureObj) if err != nil { @@ -283,7 +283,7 @@ func (xl xlObjects) PutObject(bucket string, object string, size int64, data io. xlMeta.Meta = metadata xlMeta.Stat.Size = size xlMeta.Stat.ModTime = modTime - xlMeta.AddObjectPart("object1", newMD5Hex, xlMeta.Stat.Size) + xlMeta.AddObjectPart("object00001", newMD5Hex, xlMeta.Stat.Size) if err = xl.writeXLMetadata(bucket, object, xlMeta); err != nil { return "", toObjectErr(err, bucket, object) }