diff --git a/lib/core_ext/active_record/connection_adapters/cockroachdb/lock.rb b/lib/core_ext/active_record/connection_adapters/cockroachdb/lock.rb new file mode 100644 index 000000000000..f95cba0f0ced --- /dev/null +++ b/lib/core_ext/active_record/connection_adapters/cockroachdb/lock.rb @@ -0,0 +1,12 @@ +# Cockroachdb does not implement the locking of select...for update. +# but, it doesn't need it since it uses serialised updates. So +# we make it a no-op +# https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/21 +module ActiveRecord + class Base + def lock!(lock = true) + super(lock) unless self.class.connection.class.to_s == 'ActiveRecord::ConnectionAdapters::CockroachDBAdapter' + end + end +end +