jclouds-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject jclouds git commit: JCLOUDS-1477: Upload single part for small B2 MPU
Date Wed, 19 Dec 2018 06:42:22 GMT
Repository: jclouds
Updated Branches:
  refs/heads/master 25f2bcd8c -> a6cb6cde2


JCLOUDS-1477: Upload single part for small B2 MPU

B2 requires two parts to use multi-part upload but jclouds will
attempt to use one with small uploads.  Instead it should fall back to
single-part when the content length is small.


Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/a6cb6cde
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/a6cb6cde
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/a6cb6cde

Branch: refs/heads/master
Commit: a6cb6cde29278d108c7ea757d7c20053038962c2
Parents: 25f2bcd
Author: Andrew Gaul <gaul@apache.org>
Authored: Tue Dec 18 22:09:35 2018 -0800
Committer: Andrew Gaul <gaul@apache.org>
Committed: Tue Dec 18 22:42:01 2018 -0800

----------------------------------------------------------------------
 .../org/jclouds/b2/blobstore/B2BlobStore.java   |  4 ++-
 .../integration/B2BlobIntegrationLiveTest.java  | 30 --------------------
 2 files changed, 3 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/a6cb6cde/providers/b2/src/main/java/org/jclouds/b2/blobstore/B2BlobStore.java
----------------------------------------------------------------------
diff --git a/providers/b2/src/main/java/org/jclouds/b2/blobstore/B2BlobStore.java b/providers/b2/src/main/java/org/jclouds/b2/blobstore/B2BlobStore.java
index 0069e25..c36773f 100644
--- a/providers/b2/src/main/java/org/jclouds/b2/blobstore/B2BlobStore.java
+++ b/providers/b2/src/main/java/org/jclouds/b2/blobstore/B2BlobStore.java
@@ -229,7 +229,9 @@ public final class B2BlobStore extends BaseBlobStore {
          throw new UnsupportedOperationException("B2 only supports private access blobs");
       }
 
-      if (options.isMultipart()) {
+      long contentLength = Preconditions.checkNotNull(blob.getMetadata().getContentMetadata().getContentLength(),
+            "must provide content-length to use multi-part upload");
+      if (options.isMultipart() && contentLength >= auth.get().recommendedPartSize())
{
          return putMultipartBlob(container, blob, options);
       } else {
          String name = blob.getMetadata().getName();

http://git-wip-us.apache.org/repos/asf/jclouds/blob/a6cb6cde/providers/b2/src/test/java/org/jclouds/b2/blobstore/integration/B2BlobIntegrationLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/b2/src/test/java/org/jclouds/b2/blobstore/integration/B2BlobIntegrationLiveTest.java
b/providers/b2/src/test/java/org/jclouds/b2/blobstore/integration/B2BlobIntegrationLiveTest.java
index 85d37fa..b7acf98 100644
--- a/providers/b2/src/test/java/org/jclouds/b2/blobstore/integration/B2BlobIntegrationLiveTest.java
+++ b/providers/b2/src/test/java/org/jclouds/b2/blobstore/integration/B2BlobIntegrationLiveTest.java
@@ -244,36 +244,6 @@ public final class B2BlobIntegrationLiveTest extends BaseBlobIntegrationTest
{
       }
    }
 
-   @Test(groups = { "integration", "live" })
-   public void testPutBlobTierStandardMultipart() throws Exception {
-      try {
-         super.testPutBlobTierStandardMultipart();
-         failBecauseExceptionWasNotThrown(IllegalArgumentException.class);
-      } catch (IllegalArgumentException iae) {
-         throw new SkipException("B2 requires at least two parts", iae);
-      }
-   }
-
-   @Test(groups = { "integration", "live" })
-   public void testPutBlobTierInfrequentMultipart() throws Exception {
-      try {
-         super.testPutBlobTierInfrequentMultipart();
-         failBecauseExceptionWasNotThrown(IllegalArgumentException.class);
-      } catch (IllegalArgumentException iae) {
-         throw new SkipException("B2 requires at least two parts", iae);
-      }
-   }
-
-   @Test(groups = { "integration", "live" })
-   public void testPutBlobTierArchiveMultipart() throws Exception {
-      try {
-         super.testPutBlobTierArchiveMultipart();
-         failBecauseExceptionWasNotThrown(IllegalArgumentException.class);
-      } catch (IllegalArgumentException iae) {
-         throw new SkipException("B2 requires at least two parts", iae);
-      }
-   }
-
    @Override
    protected void checkTier(BlobMetadata metadata, Tier expected) {
       // B2 maps all tiers to STANDARD


Mime
View raw message