-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Extract and dry more IO logic out of searchable snapshots module #93512
Extract and dry more IO logic out of searchable snapshots module #93512
Conversation
Extracting more of the IO logic to the blob cache to make it reusable as well as dry it up a little. Small changes to the EOF exception message format in 2 cases in here that only remove redundant information.
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
x-pack/plugin/blob-cache/src/main/java/org/elasticsearch/blobcache/BlobCacheUtils.java
Outdated
Show resolved
Hide resolved
@@ -20,4 +30,56 @@ public class BlobCacheUtils { | |||
public static int toIntBytes(long l) { | |||
return ByteSizeUnit.BYTES.toIntBytes(l); | |||
} | |||
|
|||
public static void throwEOF(long channelPos, long len, Object file) throws EOFException { |
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.
Let's add a unit test to ensure it effectively throws in case someone changes that behavior in the future
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.
How do you mean? Just a test that passes random inputs and verifies that it always throws? Why would anybody change that behavior?:) It's the only line in the method?
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.
Oh sorry I meant to have some basic test coverage on readSafe()
that throws using this method. We have many Streams.read*
and now BlobCacheUtils.readSafe()
utility methods but we are lacking basic test coverage I think
Thanks Tanguy! |
Extracting more of the IO logic to the blob cache to make it reusable as well as dry it up a little. Small changes to the EOF exception message format in 2 cases in here that only remove redundant information.