diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2016-08-04 15:57:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-04 15:57:34 -0700 |
commit | 320d40123ab0befe248373aab8ac2e2a3dec33cd (patch) | |
tree | 5c5343b99cb0d08147f2d869ee1ffb04e112971c /activerecord | |
parent | 01a69e27a4e55504af8fe776826d659550e6f89e (diff) | |
parent | 7443a332a74d7e77f2a4fa2b1e9118da08351121 (diff) | |
download | rails-320d40123ab0befe248373aab8ac2e2a3dec33cd.tar.gz rails-320d40123ab0befe248373aab8ac2e2a3dec33cd.tar.bz2 rails-320d40123ab0befe248373aab8ac2e2a3dec33cd.zip |
Merge pull request #26059 from rails/rename-deadlock-detected-to-deadlocked
The problem isn't the detection but the deadlock itself
Diffstat (limited to 'activerecord')
5 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index acc21866f1..5e9705e02f 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -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 diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index e213c991c8..8a1fdc9f92 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -422,7 +422,7 @@ module ActiveRecord when SERIALIZATION_FAILURE SerializationFailure.new(message) when DEADLOCK_DETECTED - DeadlockDetected.new(message) + Deadlocked.new(message) else super end diff --git a/activerecord/lib/active_record/errors.rb b/activerecord/lib/active_record/errors.rb index 3f75ce4099..03e6e1eee3 100644 --- a/activerecord/lib/active_record/errors.rb +++ b/activerecord/lib/active_record/errors.rb @@ -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 diff --git a/activerecord/test/cases/adapters/mysql2/transaction_test.rb b/activerecord/test/cases/adapters/mysql2/transaction_test.rb index 1a88b9cbca..5d8765d63a 100644 --- a/activerecord/test/cases/adapters/mysql2/transaction_test.rb +++ b/activerecord/test/cases/adapters/mysql2/transaction_test.rb @@ -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 diff --git a/activerecord/test/cases/adapters/postgresql/transaction_test.rb b/activerecord/test/cases/adapters/postgresql/transaction_test.rb index 87d1fffe19..8dea92c785 100644 --- a/activerecord/test/cases/adapters/postgresql/transaction_test.rb +++ b/activerecord/test/cases/adapters/postgresql/transaction_test.rb @@ -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 |