From 8cd68a35033312cd54822bc3f8e46ed629810712 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Thu, 4 Jan 2018 15:41:35 -0800 Subject: [PATCH] JCLOUDS-1369: improving slicing with many parts Previously with GCS and its maximum 32 parts, the slicing algorithm would sliced 3.2 GB blobs into (31) 32 MB parts and (1) 2.3 GB part. With this algorithm it creates (31) 100 MB parts and (1) smaller part. --- .../internal/MultipartUploadSlicingAlgorithm.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/MultipartUploadSlicingAlgorithm.java b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/MultipartUploadSlicingAlgorithm.java index eb4074f972..f8cc9f3f0b 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/MultipartUploadSlicingAlgorithm.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/MultipartUploadSlicingAlgorithm.java @@ -103,14 +103,10 @@ public final class MultipartUploadSlicingAlgorithm { unitPartSize = maximumPartSize; parts = (int)(length / unitPartSize); } - if (parts > maximumNumberOfParts) { // if splits in too many parts or - // cannot be split - unitPartSize = minimumPartSize; // take the minimum part size - parts = (int)(length / unitPartSize); - } - if (parts > maximumNumberOfParts) { // if still splits in too many parts - parts = maximumNumberOfParts - 1; // limit them. do not care about not - // covering + if (parts > maximumNumberOfParts) { + partSize = length / maximumNumberOfParts; + unitPartSize = partSize; + parts = maximumNumberOfParts; } long remainder = length % unitPartSize; if (remainder == 0 && parts > 0) {