1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #26059 from rails/rename-deadlock-detected-to-deadlocked

The problem isn't the detection but the deadlock itself
This commit is contained in:
David Heinemeier Hansson 2016-08-04 15:57:34 -07:00 committed by GitHub
commit 320d40123a
5 changed files with 8 additions and 8 deletions

View file

@ -753,7 +753,7 @@ module ActiveRecord
when ER_DATA_TOO_LONG
ValueTooLong.new(message)
when ER_LOCK_DEADLOCK
DeadlockDetected.new(message)
Deadlocked.new(message)
else
super
end

View file

@ -422,7 +422,7 @@ module ActiveRecord
when SERIALIZATION_FAILURE
SerializationFailure.new(message)
when DEADLOCK_DETECTED
DeadlockDetected.new(message)
Deadlocked.new(message)
else
super
end

View file

@ -300,9 +300,9 @@ module ActiveRecord
class SerializationFailure < TransactionRollbackError
end
# DeadlockDetected will be raised when a transaction is rolled
# Deadlocked will be raised when a transaction is rolled
# back by the database when a deadlock is encountered.
class DeadlockDetected < TransactionRollbackError
class Deadlocked < TransactionRollbackError
end
# IrreversibleOrderError is raised when a relation's order is too complex for

View file

@ -27,8 +27,8 @@ module ActiveRecord
@connection.drop_table 'samples', if_exists: true
end
test "raises DeadlockDetected when a deadlock is encountered" do
assert_raises(ActiveRecord::DeadlockDetected) do
test "raises Deadlocked when a deadlock is encountered" do
assert_raises(ActiveRecord::Deadlocked) do
s1 = Sample.create value: 1
s2 = Sample.create value: 2

View file

@ -58,9 +58,9 @@ module ActiveRecord
end
end
test "raises DeadlockDetected when a deadlock is encountered" do
test "raises Deadlocked when a deadlock is encountered" do
with_warning_suppression do
assert_raises(ActiveRecord::DeadlockDetected) do
assert_raises(ActiveRecord::Deadlocked) do
s1 = Sample.create value: 1
s2 = Sample.create value: 2