aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2017-11-18 00:25:52 +1030
committerGitHub <noreply@github.com>2017-11-18 00:25:52 +1030
commit56c1326abb11ed275f04b6e0592ca66975e37f24 (patch)
tree6a7718a66d73d0369a33caeb4b4cdd87c44ebbad /activerecord
parenteed3d3fff5ca6be00b2fe0fe020bd025ddbabbd5 (diff)
parent1f9f6f6cfc57020ccb35f77872c56f069f337075 (diff)
downloadrails-56c1326abb11ed275f04b6e0592ca66975e37f24.tar.gz
rails-56c1326abb11ed275f04b6e0592ca66975e37f24.tar.bz2
rails-56c1326abb11ed275f04b6e0592ca66975e37f24.zip
Merge pull request #31035 from BrentWheeldon/bmw-db-load-deadlock
Prevent deadlocks with load interlock and DB lock.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract_adapter.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
index 345983a655..7e6db860dd 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -5,6 +5,7 @@ require "active_record/connection_adapters/schema_cache"
require "active_record/connection_adapters/sql_type_metadata"
require "active_record/connection_adapters/abstract/schema_dumper"
require "active_record/connection_adapters/abstract/schema_creation"
+require "active_support/concurrency/load_interlock_aware_monitor"
require "arel/collectors/bind"
require "arel/collectors/composite"
require "arel/collectors/sql_string"
@@ -107,7 +108,7 @@ module ActiveRecord
@schema_cache = SchemaCache.new self
@quoted_column_names, @quoted_table_names = {}, {}
@visitor = arel_visitor
- @lock = Monitor.new
+ @lock = ActiveSupport::Concurrency::LoadInterlockAwareMonitor.new
if self.class.type_cast_config_to_boolean(config.fetch(:prepared_statements) { true })
@prepared_statements = true