From 13ab8e17e2baadf2c375dbee0725afe4dda99254 Mon Sep 17 00:00:00 2001 From: Krishna Srinivas Date: Wed, 21 Jun 2017 10:27:44 -0700 Subject: [PATCH] gateway-gcs: use minio.sys.temp/multipart/v1 as url base (#4562) --- cmd/gateway-gcs.go | 10 ++++++---- cmd/gateway-gcs_test.go | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cmd/gateway-gcs.go b/cmd/gateway-gcs.go index 64877d4d5..135090c36 100644 --- a/cmd/gateway-gcs.go +++ b/cmd/gateway-gcs.go @@ -43,7 +43,9 @@ const ( // ListObjects we filter out this entry. gcsMinioPath = "minio.sys.temp" // Path where multipart objects are saved. - gcsMinioMultipartPath = gcsMinioPath + "/multipart" + // If we change the backend format we will use a different url path like /multipart/v2 + // but we will not migrate old data. + gcsMinioMultipartPathV1 = gcsMinioPath + "/multipart/v1" // Multipart meta file. gcsMinioMultipartMeta = "gcs.json" // gcs.json version number @@ -68,12 +70,12 @@ func isGCSPrefix(prefix string) bool { // Returns name of the multipart meta object. func gcsMultipartMetaName(uploadID string) string { - return fmt.Sprintf("%s/%s/%s", gcsMinioMultipartPath, uploadID, gcsMinioMultipartMeta) + return fmt.Sprintf("%s/%s/%s", gcsMinioMultipartPathV1, uploadID, gcsMinioMultipartMeta) } // Returns name of the part object. func gcsMultipartDataName(uploadID, etag string) string { - return fmt.Sprintf("%s/%s/%s", gcsMinioMultipartPath, uploadID, etag) + return fmt.Sprintf("%s/%s/%s", gcsMinioMultipartPathV1, uploadID, etag) } // Convert Minio errors to minio object layer errors. @@ -726,7 +728,7 @@ func (l *gcsGateway) cleanupMultipartUpload(bucket, key, uploadID string) error return gcsToObjectError(traceError(err), bucket, key) } - prefix := fmt.Sprintf("%s/%s/", gcsMinioMultipartPath, uploadID) + prefix := fmt.Sprintf("%s/%s/", gcsMinioMultipartPathV1, uploadID) // iterate through all parts and delete them it := l.client.Bucket(bucket).Objects(l.ctx, &storage.Query{Prefix: prefix, Versions: false}) diff --git a/cmd/gateway-gcs_test.go b/cmd/gateway-gcs_test.go index 65c385eb9..41630f670 100644 --- a/cmd/gateway-gcs_test.go +++ b/cmd/gateway-gcs_test.go @@ -164,7 +164,7 @@ func TestIsGCSMarker(t *testing.T) { // Test for gcsMultipartMetaName. func TestGCSMultipartMetaName(t *testing.T) { uploadID := "a" - expected := pathJoin(gcsMinioMultipartPath, uploadID, gcsMinioMultipartMeta) + expected := pathJoin(gcsMinioMultipartPathV1, uploadID, gcsMinioMultipartMeta) got := gcsMultipartMetaName(uploadID) if expected != got { t.Errorf("expected: %s, got: %s", expected, got) @@ -175,7 +175,7 @@ func TestGCSMultipartMetaName(t *testing.T) { func TestGCSMultipartDataName(t *testing.T) { uploadID := "a" etag := "b" - expected := pathJoin(gcsMinioMultipartPath, uploadID, etag) + expected := pathJoin(gcsMinioMultipartPathV1, uploadID, etag) got := gcsMultipartDataName(uploadID, etag) if expected != got { t.Errorf("expected: %s, got: %s", expected, got)