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.
This commit is contained in:
Andrew Gaul 2018-01-04 15:41:35 -08:00
parent d05be89614
commit 8cd68a3503
1 changed files with 4 additions and 8 deletions

View File

@ -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) {