Skip to content

Conversation

@tlrx
Copy link
Member

@tlrx tlrx commented Sep 12, 2019

This commit adds support for Put Block API to the internal HTT server
used in Azure repository integration tests. This allows to test the
behavior of the Azure SDK client when the Azure Storage service
returns errors when uploading Blob in multiple blocks or when
downloading a blob using ranged downloads.

This commit adds support for Put Block API to the internal HTT server
used in Azure repository integration tests.
@tlrx tlrx added >test Issues or PRs that are addressing/adding tests :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs v8.0.0 v7.5.0 labels Sep 12, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

@Override
BlobRequestOptions getBlobRequestOptionsForWriteBlob() {
BlobRequestOptions options = new BlobRequestOptions();
options.setSingleBlobPutThresholdInBytes(Math.toIntExact(ByteSizeUnit.MB.toBytes(1)));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows to lower the threshold between single Put Blob request and Put Blocks + Put Blocks List requests.


} else if (Regex.simpleMatch("HEAD /container/*", request)) {
BytesReference blob = blobs.get(exchange.getRequestURI().toString());
final BytesReference blob = blobs.get(exchange.getRequestURI().getPath());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was wrong (ie, query parameters were part of the blob name)

protected String requestUniqueId(final HttpExchange exchange) {
// Azure SDK client provides a unique ID per request
return exchange.getRequestHeaders().getFirst(Constants.HeaderConstants.CLIENT_REQUEST_ID_HEADER);
final String requestId = exchange.getRequestHeaders().getFirst(Constants.HeaderConstants.CLIENT_REQUEST_ID_HEADER);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not notice it but HEAD and GET blob share the same request id. When reading a blob from Azure using input stream, the SDK first execute a HEAD request to know the size of the object to read and then retrieve the content using 1 or more requests, all with the same request id.

Copy link
Contributor

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :) Thanks again for this one!

* AzureRepositoryPlugin that allows to set very low values for the Azure's client retry policy
* Test the snapshot and restore of an index which has large segments files.
*/
public void testSnapshotWithLargeSegmentFiles() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we gonna build S3 multi-part uploads as well and then move this to the abstract parent? :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's the idea :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened #46802

@tlrx
Copy link
Member Author

tlrx commented Sep 13, 2019

Jenkins test this

@tlrx
Copy link
Member Author

tlrx commented Sep 17, 2019

@elasticmachine update branch

@tlrx tlrx merged commit dccee86 into elastic:master Sep 18, 2019
@tlrx tlrx deleted the add-put-block-support branch September 18, 2019 07:42
@tlrx
Copy link
Member Author

tlrx commented Sep 18, 2019

Thanks @original-brownbear !

tlrx added a commit that referenced this pull request Sep 18, 2019
This commit adds support for Put Block API to the internal HTTP server
used in Azure repository integration tests. This allows to test the
behavior of the Azure SDK client when the Azure Storage service
returns errors when uploading Blob in multiple blocks or when
downloading a blob using ranged downloads.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >test Issues or PRs that are addressing/adding tests v7.5.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants