Update azure-storage-blob to 12.15.0 (#2774)

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
This commit is contained in:
Andriy Redko 2022-04-05 18:49:42 -04:00 committed by GitHub
parent 7aa496f9dd
commit 1dbeda0f32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 4 deletions

View File

@ -54,7 +54,7 @@ dependencies {
api "io.netty:netty-resolver-dns:${versions.netty}"
api "io.netty:netty-transport-native-unix-common:${versions.netty}"
implementation project(':modules:transport-netty4')
api 'com.azure:azure-storage-blob:12.14.4'
api 'com.azure:azure-storage-blob:12.15.0'
api 'org.reactivestreams:reactive-streams:1.0.3'
api 'io.projectreactor:reactor-core:3.4.15'
api 'io.projectreactor.netty:reactor-netty:1.0.17'

View File

@ -1 +0,0 @@
2b92020693d09e4980b96d278e8038a1087afea0

View File

@ -0,0 +1 @@
a53a6bdf7564f4e3a7b0b93cd96b7f5f95c03d36

View File

@ -231,6 +231,8 @@ public class AzureBlobContainerRetriesTests extends OpenSearchTestCase {
exchange.getResponseHeaders().add("Content-Type", "application/octet-stream");
exchange.getResponseHeaders().add("Content-Length", String.valueOf(length));
exchange.getResponseHeaders().add("x-ms-blob-type", "blockblob");
exchange.getResponseHeaders()
.add("Content-Range", String.format("bytes %d-%d/%d", rangeStart, bytes.length, bytes.length));
exchange.sendResponseHeaders(RestStatus.OK.getStatus(), length);
exchange.getResponseBody().write(bytes, rangeStart, length);
return;
@ -247,7 +249,8 @@ public class AzureBlobContainerRetriesTests extends OpenSearchTestCase {
final BlobContainer blobContainer = createBlobContainer(maxRetries);
try (InputStream inputStream = blobContainer.readBlob("read_blob_max_retries")) {
assertArrayEquals(bytes, BytesReference.toBytes(Streams.readFully(inputStream)));
assertThat(countDownHead.isCountedDown(), is(true));
// No more getProperties() calls in BlobClientBase::openInputStream(), HEAD should not be invoked
assertThat(countDownHead.isCountedDown(), is(false));
assertThat(countDownGet.isCountedDown(), is(true));
}
}
@ -278,6 +281,8 @@ public class AzureBlobContainerRetriesTests extends OpenSearchTestCase {
assertThat(length, lessThanOrEqualTo(bytes.length - rangeStart));
exchange.getResponseHeaders().add("Content-Type", "application/octet-stream");
exchange.getResponseHeaders().add("Content-Length", String.valueOf(length));
exchange.getResponseHeaders()
.add("Content-Range", String.format("bytes %d-%d/%d", rangeStart, rangeEnd.get(), bytes.length));
exchange.getResponseHeaders().add("x-ms-blob-type", "blockblob");
exchange.sendResponseHeaders(RestStatus.OK.getStatus(), length);
exchange.getResponseBody().write(bytes, rangeStart, length);

View File

@ -150,12 +150,14 @@ public class AzureHttpHandler implements HttpHandler {
}
final int start = Integer.parseInt(matcher.group(1));
final int length = Integer.parseInt(matcher.group(2)) - start + 1;
final int end = Integer.parseInt(matcher.group(2));
final int length = Math.min(end - start + 1, blob.length());
exchange.getResponseHeaders().add("Content-Type", "application/octet-stream");
exchange.getResponseHeaders().add("Content-Length", String.valueOf(length));
exchange.getResponseHeaders().add("x-ms-blob-type", "blockblob");
exchange.getResponseHeaders().add("x-ms-request-server-encrypted", "false");
exchange.getResponseHeaders().add("Content-Range", String.format("bytes %d-%d/%d", start, Math.min(end, length), length));
exchange.sendResponseHeaders(RestStatus.OK.getStatus(), length);
exchange.getResponseBody().write(blob.toBytesRef().bytes, start, length);