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

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

@rails-bot rails-bot commented Aug 22, 2017

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.

activerecord/lib/active_record/errors.rb Outdated
@@ -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

This comment has been minimized.

@rafaelfranca

rafaelfranca Aug 22, 2017
Member

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

This comment has been minimized.

@gcourtemanche

gcourtemanche Aug 22, 2017
Author Contributor

Fixed, thank you

Copy link
Member

@rafaelfranca rafaelfranca left a comment

Can you squash your commits?

@matthewd
Copy link
Member

@matthewd matthewd commented Aug 22, 2017

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

@rafaelfranca
Copy link
Member

@rafaelfranca rafaelfranca commented Aug 22, 2017

What you recommend it to be? LockWaitTimeout?

@matthewd
Copy link
Member

@matthewd matthewd commented Aug 22, 2017

@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

@rafaelfranca rafaelfranca commented Aug 22, 2017

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

@gcourtemanche gcourtemanche commented Aug 22, 2017

@rafaelfranca Yes, renamed to TransactionTimeout

@rafaelfranca rafaelfranca merged commit 80ccfec into rails:master Aug 22, 2017
2 checks passed
2 checks passed
codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.