Skip to content
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

Add TransactionTimeout for MySQL error code 1205 #30360

Merged
merged 1 commit into from Aug 22, 2017
Merged

Add TransactionTimeout for MySQL error code 1205 #30360

merged 1 commit into from Aug 22, 2017

Conversation

gcourtemanche
Copy link
Contributor

@gcourtemanche gcourtemanche commented Aug 22, 2017

Summary

This PR adds TransactionTimedout error to the MySQL adapter. Message: Lock wait timeout exceeded; try restarting transaction (MySQL error 1205) will be easier to rescue.

https://dev.mysql.com/doc/refman/5.7/en/error-messages-server.html#error_er_lock_wait_timeout

cc @rafaelfranca

@rails-bot
Copy link

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @schneems (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.

Please see the contribution instructions for more information.

@@ -334,4 +334,9 @@ class Deadlocked < TransactionRollbackError
# +reverse_order+ to automatically reverse.
class IrreversibleOrderError < ActiveRecordError
end

# TransactionTimedout will be raised when lock wait timeout expires.
# wait time value is set by innodb_lock_wait_timeout
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait instead of wait. And it is missing a . in the end.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thank you

Copy link
Member

@rafaelfranca rafaelfranca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you squash your commits?

@matthewd
Copy link
Member

Should this be TransactionTimeout? We've got Deadlocked, but that seems to be an exception.

@rafaelfranca
Copy link
Member

What you recommend it to be? LockWaitTimeout?

@matthewd
Copy link
Member

@rafaelfranca either one seems fine to me. TransactionTimedout sounds less consistent... I think the noun form fits with wider exception naming: it's FrobError, not FrobFailed. It's a fairly fine distinction, but I think an exception describes what occurred that prevented the action, rather than why the action couldn't be performed.

@rafaelfranca
Copy link
Member

Yeah, it makes sense. I think TransactionTimeout is better than LockWaitTimeout since it is more generic. @gcourtemanche can you rename the exception from TransactionTimedout to TransactionTimeout?

@gcourtemanche gcourtemanche changed the title Add TransactionTimedout for MySQL error code 1205 Add TransactionTimeout for MySQL error code 1205 Aug 22, 2017
@gcourtemanche
Copy link
Contributor Author

@rafaelfranca Yes, renamed to TransactionTimeout

@rafaelfranca rafaelfranca merged commit 80ccfec into rails:master Aug 22, 2017
prathamesh-sonpatki added a commit to prathamesh-sonpatki/rails that referenced this pull request Aug 28, 2017
kamipo added a commit that referenced this pull request Aug 29, 2017
kamipo added a commit that referenced this pull request Nov 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants