New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix AzureBlobStore#convertStreamToByteBuffer chunking in Windows #78772
Conversation
Today we were using Math.ceil in order to calculate the number of chunks in the request. Since we cast the values to a double... there be dragons. This could cause issues depending on the platform. This commit uses good old integers to compute the number of parts.
Pinging @elastic/es-distributed (Team:Distributed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks Francisco!
@@ -547,7 +547,11 @@ public synchronized int read() throws IOException { | |||
// reclaim them (see MonoSendMany). Additionally, that very same operator requests | |||
// 128 elements (that's hardcoded) once it's subscribed (later on, it requests | |||
// by 64 elements), that's why we provide 64kb buffers. | |||
return Flux.range(0, (int) Math.ceil((double) length / (double) chunkSize)) | |||
|
|||
// length it's at most 100MB so it's safe to cast back to an integer in this case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
length is
I guess:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦
Thanks Armin! |
…stic#78772) Today we are using Math.ceil in order to calculate the number of chunks in the request. Since we cast the values to a double... there be dragons. This could cause issues depending on the platform. This commit uses good old integers to compute the number of parts.
…stic#78772) Today we are using Math.ceil in order to calculate the number of chunks in the request. Since we cast the values to a double... there be dragons. This could cause issues depending on the platform. This commit uses good old integers to compute the number of parts.
Today we are using Math.ceil in order to calculate the number of
chunks in the request. Since we cast the values to a double...
there be dragons. This could cause issues depending on the platform.
This commit uses good old integers to compute the number of parts.