-
Notifications
You must be signed in to change notification settings - Fork 38
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
Should perform lazy recovery in implicit pre-read #1476
Should perform lazy recovery in implicit pre-read #1476
Conversation
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.
Good catch! LGTM, thank you!
@@ -135,6 +134,9 @@ public void commit() throws CommitException, UnknownTransactionStatusException { | |||
try { | |||
crud.readIfImplicitPreReadEnabled(); | |||
} catch (CrudConflictException e) { | |||
if (e instanceof UncommittedRecordException) { |
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.
[minor] Or, explicitly catching UncommittedRecordException is also an option?
// Execute implicit pre-read
try {
crud.readIfImplicitPreReadEnabled();
} catch (UncommittedRecordException e) {
lazyRecovery(e);
throw new CommitConflictException("Read uncommitted record while implicit pre-read", e, getId());
} catch (CrudConflictException e) {
throw new CommitConflictException("Conflict occurred while implicit pre-read", e, getId());
} catch (CrudException e) {
throw new CommitException("Failed to execute implicit pre-read", e, getId());
}
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.
Yeah, that's an option. I didn't do that because I didn't think we needed to change the error message base on the cause, as we pass the cause exception to CommitConflictException
.
throw new CommitConflictException("Conflict occurred while implicit pre-read", e /* the cause exception */, getId());
What do you think?
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.
Sounds good
@@ -137,6 +136,9 @@ public void prepare() throws PreparationException { | |||
try { | |||
crud.readIfImplicitPreReadEnabled(); | |||
} catch (CrudConflictException e) { | |||
if (e instanceof UncommittedRecordException) { |
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.
[minor] Same as above
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! Thank you for handling it quickly : )
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.
Overall, looking good. Left a minor comment. PTAL!
} | ||
|
||
@SuppressFBWarnings("EI_EXPOSE_REP2") | ||
public UncommittedRecordException( |
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 seems not used. Do you want to keep it for future use?
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.
I left this here because it was originally here. But yes, we don't need to leave it. I'll remove it. Thanks.
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.
Fixed in 5c4d6a7. Thanks.
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! Thank you!
Description
Currently, when uncommitted records are read while executing implicit pre-read, lazy recovery is not performed, which is unexpected behavior. This PR addresses issue.
Related issues and/or PRs
Changes made
Checklist
Additional notes (optional)
N/A
Release notes
Fixed a bug where lazy recovery is not performed when uncommitted records are read while executing implicit pre-read.