JCLOUDS-1394: Increase Azure max blob size to 256MB

This commit is contained in:
Alin Dreghiciu 2018-03-09 12:28:51 +02:00 committed by Andrew Gaul
parent 584ca19fad
commit 775921cd5d
3 changed files with 11 additions and 9 deletions

View File

@ -321,10 +321,10 @@ public interface AzureBlobClient extends Closeable {
* blob.
* <p/>
* <h4>Remarks</h4>
* The maximum upload size for a blob is 64 MB. If your blob is larger than 64 MB, you may upload
* The maximum upload size for a blob is 256 MB. If your blob is larger than 256 MB, you may upload
* it as a set of blocks. For more information, see the Put Block and Put Block List operations.
* <p/>
* If you attempt to upload a blob that is larger than 64 MB, the service returns status code 413
* If you attempt to upload a blob that is larger than 256 MB, the service returns status code 413
* (Request Payload Too Large). The Blob service also returns additional information about the
* error in the response, including the maximum blob size permitted in bytes.
*/

View File

@ -76,9 +76,11 @@ public class BindAzureBlobMetadataToRequest implements Binder {
headers.put("x-ms-blob-content-length", blob.getPayload().getContentMetadata().getContentLength().toString());
break;
case BLOCK_BLOB:
// see https://docs.microsoft.com/en-us/rest/api/storageservices/understanding-block-blobs--append-blobs--and-page-blobs
// see AzureBlobApiMetadata#version (current API version used is 2017-04-17)
checkArgument(
checkNotNull(blob.getPayload().getContentMetadata().getContentLength(), "blob.getContentLength()") <= 64L * 1024 * 1024,
"maximum size for put Blob is 64MB");
checkNotNull(blob.getPayload().getContentMetadata().getContentLength(), "blob.getContentLength()") <= 256L * 1024 * 1024,
"maximum size for put Blob is 256MB");
break;
}
request = (R) request.toBuilder().replaceHeaders(Multimaps.forMap(headers.build())).build();

View File

@ -35,10 +35,10 @@ import com.google.common.collect.ImmutableMap;
public class BindAzureBlobMetadataToRequestTest extends BaseRestAnnotationProcessingTest<AzureBlobClient> {
@Test
public void testPassWithMinimumDetailsAndPayload64MB() {
public void testPassWithMinimumDetailsAndPayload256MB() {
AzureBlob blob = injector.getInstance(AzureBlob.Factory.class).create(null);
Payload payload = Payloads.newStringPayload("");
payload.getContentMetadata().setContentLength(64 * 1024 * 1024L);
payload.getContentMetadata().setContentLength(256 * 1024 * 1024L);
blob.setPayload(payload);
blob.getProperties().setName("foo");
@ -55,7 +55,7 @@ public class BindAzureBlobMetadataToRequestTest extends BaseRestAnnotationProces
public void testExtendedPropertiesBind() {
AzureBlob blob = injector.getInstance(AzureBlob.Factory.class).create(null);
Payload payload = Payloads.newStringPayload("");
payload.getContentMetadata().setContentLength(64 * 1024 * 1024L);
payload.getContentMetadata().setContentLength(256 * 1024 * 1024L);
blob.setPayload(payload);
blob.getProperties().setName("foo");
blob.getProperties().setMetadata(ImmutableMap.of("foo", "bar"));
@ -96,10 +96,10 @@ public class BindAzureBlobMetadataToRequestTest extends BaseRestAnnotationProces
}
@Test(expectedExceptions = IllegalArgumentException.class)
public void testOver64MBIsBad() {
public void testOver256MBIsBad() {
AzureBlob blob = injector.getInstance(AzureBlob.Factory.class).create(null);
Payload payload = Payloads.newStringPayload("");
payload.getContentMetadata().setContentLength(64 * 1024 * 1024L + 1);
payload.getContentMetadata().setContentLength(256 * 1024 * 1024L + 1);
blob.setPayload(payload);
blob.getProperties().setName("foo");