Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[6.0] Fix exception handling on transaction commit in DB::transaction() #29067
[6.0] Fix exception handling on transaction commit in DB::transaction() #29067
Changes from 5 commits
b78bf2d
463144c
3c3daad
c6d4e6a
2ee59b1
53ae6e9
abaff32
a6bfc98
eabf2d1
b1e27df
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Cosmetic suggestion: We could move
return $callbackReturn;
in here and removecontinue;
from thecatch
block.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.
@staudenmeir I considered that initially, but I think this way makes the pattern of "if something goes wrong, continue; return at the end" more clear. In fact, while working on this PR I initially forgot to put in the first
continue
a few lines up, and it took several minutes to figure out why I was failing unit tests. So while your way is slightly more concise, I think this way is more readable and makes the code easier to modify 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.
Uh,
SQLSTATE 40001
is database specific .. no? I don't think this is supposed to be in this "shared" handling code.Why is only this particular error generating this problem and not others?
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.
Actually, no. SQLSTATE error codes are part of the SQL standard. PostgreSQL, MySQL, SQL Server, Oracle, and IBM databases all use SQLSTATE 40001 to report serialization failures. Many databases additionally use their own error codes to provide more detailed information, but the value returned by
PDOException::getCode()
is the SQLSTATE code.Any exception occurring during commit would cause the rollback problem. We do need special handling for serialization failures, though, because that is a case where (just like a deadlock) retrying the transaction is the correct course of action.
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.
#TIL , thanks