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
Refactor the Translog.read(Location) method #7780
Conversation
LGTM |
} | ||
} catch (IOException e) { | ||
// switched on us, read it from the reader | ||
Translog.Operation op = translog.read(versionValue.translogLocation()); |
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.
this can still cause an IOException no? so we should keep the catch block here?
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 no it now throws ElasticsearchException
which I think is weird it should throw IOException
I left some comments |
LGTM |
6089526
to
168b375
Compare
It was only used by `readSource`, it has been changed to return a Translog.Operation, which can have .getSource() called on it to return the source. `readSource` has been removed. This also removes the checked IOException, any exception thrown is unexpected and should throw a runtime exception. Moves the ReleasableBytesStreamOutput allocation into the body of the try-catch block so the lock can be released in the event of an exception during allocation.
It was only used by
readSource
, it has been changed to return aTranslog.Operation, which can have .getSource() called on it to return
the source.
readSource
has been removed.This also removes the checked IOException, any exception thrown is
unexpected and should throw a runtime exception.
Moves the ReleasableBytesStreamOutput allocation into the body of the
try-catch block so the lock can be released in the event of an exception
during allocation.