Skip to content

Conversation

tlrx
Copy link
Member

@tlrx tlrx commented May 26, 2025

Relates ES-11815

@tlrx tlrx added >enhancement :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs v9.1.0 labels May 26, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @tlrx, I've created a changelog YAML for you.

@elasticsearchmachine elasticsearchmachine added the serverless-linked Added by automation, don't add manually label May 26, 2025
@tlrx tlrx requested a review from henningandersen May 26, 2025 10:03
Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

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

Looks great, left a few comments.

.getBlobAsyncClient(blobName)
.getBlockBlobAsyncClient();

Flux.fromIterable(multiparts)
Copy link
Contributor

Choose a reason for hiding this comment

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

:thu: neat

.block();
}
} catch (final BlobStorageException e) {
if (failIfAlreadyExists
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be follow-up for sure, but I guess we may need some cleanup to deal with failures, deleting the staged blocks? I notice that the original version also does not seem to care so we can defer for now.

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, there is more work to do for handling failures. I'll create a task for this if we decide to go this route.


private static InputStream toSynchronizedInputStream(String blobName, InputStream delegate, MultiPart multipart) {
assert delegate.markSupported() : "An InputStream with mark support was expected";
// We need to introduce a read barrier in order to provide visibility for the underlying
Copy link
Contributor

Choose a reason for hiding this comment

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

Let us leave this for now, but it seems strange to need this synchronized part really, since we expect it to be used serially only anyway - and this must require a happens-before relationship established in reactor code even if this is used across threads.

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 commented #128449 (comment)

stream.mark(Integer.MAX_VALUE);
final var bytesRead = new AtomicLong(0L);
return Flux.defer(() -> {
// Code in this Flux.defer() can be concurrently executed by multiple threads
Copy link
Contributor

Choose a reason for hiding this comment

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

Can it? I think that would break everything. I think it is an existing assumption and code comment copy - but if you agree that it should not perhaps worth adding a question mark/todo around it?

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 the case when I worked on this last week, I could see different repository_azure threads resetting the same input stream instance concurrently so I assumed the existing comment was also applicable.

I updated the comment so that we can revisit this later, now I fixed the bugs I made.

Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

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

LGTM.

We should tackle tests too, but I am good with merging this since it is not really used and we can start benchmarking the effect more easily then.

@tlrx tlrx marked this pull request as ready for review May 26, 2025 12:37
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Coordination Meta label for Distributed Coordination team label May 26, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination)

@tlrx tlrx changed the title [Draft] Support concurrent multipart uploads in Azure Support concurrent multipart uploads in Azure May 26, 2025
@tlrx tlrx merged commit 3bc6a43 into elastic:main May 27, 2025
18 checks passed
@tlrx
Copy link
Member Author

tlrx commented May 27, 2025

Thanks Henning!

@tlrx tlrx deleted the 2025/05/23/ES-11815 branch May 27, 2025 11:01
tlrx added a commit that referenced this pull request May 28, 2025
Enhances existing integration test to account for #128449. Relates ES-11815
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 >enhancement serverless-linked Added by automation, don't add manually Team:Distributed Coordination Meta label for Distributed Coordination team v9.1.0

3 participants