diff options
-rw-r--r-- | .travis.yml | 25 | ||||
-rw-r--r-- | RELEASING_RAILS.md | 12 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/adapters/mysql2/transaction_test.rb | 24 | ||||
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/transaction_test.rb | 4 |
5 files changed, 47 insertions, 20 deletions
diff --git a/.travis.yml b/.travis.yml index bafceaa292..86328e0ef6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,6 @@ cache: services: - memcached - redis - - rabbitmq addons: postgresql: "9.4" @@ -23,8 +22,6 @@ before_install: - "pushd /tmp/beanstalkd-1.10 && make && (./beanstalkd &); popd" before_script: - - bundle update - # Set Sauce Labs username and access key. Obfuscated, purposefully not encrypted. # Decodes to e.g. `export VARIABLE=VALUE` - $(base64 --decode <<< "ZXhwb3J0IFNBVUNFX0FDQ0VTU19LRVk9YTAzNTM0M2YtZTkyMi00MGIzLWFhM2MtMDZiM2VhNjM1YzQ4") @@ -45,7 +42,6 @@ env: - "GEM=ar:mysql2" - "GEM=ar:sqlite3" - "GEM=ar:postgresql" - - "GEM=aj:integration" - "GEM=guides" rvm: @@ -55,10 +51,27 @@ rvm: matrix: include: - # Latest compiled version in http://rubies.travis-ci.org + - rvm: 2.2.6 + env: "GEM=aj:integration" + services: + - memcached + - redis + - rabbitmq + - rvm: 2.3.3 + env: "GEM=aj:integration" + services: + - memcached + - redis + - rabbitmq + - rvm: ruby-head + env: "GEM=aj:integration" + services: + - memcached + - redis + - rabbitmq - rvm: 2.3.3 env: - - "GEM=ar:mysql2" + - "GEM=ar:mysql2 MYSQL=mariadb" addons: mariadb: 10.0 - rvm: jruby-9.1.5.0 diff --git a/RELEASING_RAILS.md b/RELEASING_RAILS.md index ec8d2b657f..10a8bca3b3 100644 --- a/RELEASING_RAILS.md +++ b/RELEASING_RAILS.md @@ -103,17 +103,19 @@ branch. Run `rake install` to generate the gems and install them locally. Then try generating a new app and ensure that nothing explodes. -Verify that Action Cable's package.json is updated with the RC version. +Verify that Action Cable and Action View's package.json files are updated with +the RC version. This will stop you from looking silly when you push an RC to rubygems.org and then realize it is broken. ### Release to RubyGems and NPM. -IMPORTANT: The Action Cable client is released as an NPM package, so you must -have Node.js installed, have an NPM account (npmjs.com), and be an actioncable -package owner (`npm owner ls actioncable`) to do a full release. Do not release -until you're set up with NPM! +IMPORTANT: The Action Cable client and Action View's UJS adapter are released +as NPM packages, so you must have Node.js installed, have an NPM account +(npmjs.com), and be a package owner for `actioncable` and `rails-ujs` (you can +check this via `npm owner ls actioncable` and `npm owner ls rails-ujs`) in +order to do a full release. Do not release until you're set up with NPM! Run `rake release`. This will populate the gemspecs and NPM package.json with the current RAILS_VERSION, commit the changes, tag it, and push the gems to diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb index d17722adec..5ec2fc073e 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -422,6 +422,7 @@ module ActiveRecord conn.disconnect! end @connections = [] + @available.clear end end end @@ -454,6 +455,7 @@ module ActiveRecord conn.disconnect! if conn.requires_reloading? end @connections.delete_if(&:requires_reloading?) + @available.clear end end end diff --git a/activerecord/test/cases/adapters/mysql2/transaction_test.rb b/activerecord/test/cases/adapters/mysql2/transaction_test.rb index edd5353ee3..16101e38cb 100644 --- a/activerecord/test/cases/adapters/mysql2/transaction_test.rb +++ b/activerecord/test/cases/adapters/mysql2/transaction_test.rb @@ -10,6 +10,8 @@ module ActiveRecord end setup do + @abort, Thread.abort_on_exception = Thread.abort_on_exception, false + @connection = ActiveRecord::Base.connection @connection.clear_cache! @@ -25,30 +27,34 @@ module ActiveRecord teardown do @connection.drop_table "samples", if_exists: true + + Thread.abort_on_exception = @abort end test "raises Deadlocked when a deadlock is encountered" do assert_raises(ActiveRecord::Deadlocked) do + barrier = Concurrent::CyclicBarrier.new(2) + s1 = Sample.create value: 1 s2 = Sample.create value: 2 thread = Thread.new do Sample.transaction do s1.lock! - sleep 1 + barrier.wait s2.update_attributes value: 1 end end - sleep 0.5 - - Sample.transaction do - s2.lock! - sleep 1 - s1.update_attributes value: 2 + begin + Sample.transaction do + s2.lock! + barrier.wait + s1.update_attributes value: 2 + end + ensure + thread.join end - - thread.join end end end diff --git a/activerecord/test/cases/adapters/postgresql/transaction_test.rb b/activerecord/test/cases/adapters/postgresql/transaction_test.rb index c450524de8..f130e344c4 100644 --- a/activerecord/test/cases/adapters/postgresql/transaction_test.rb +++ b/activerecord/test/cases/adapters/postgresql/transaction_test.rb @@ -11,6 +11,8 @@ module ActiveRecord end setup do + @abort, Thread.abort_on_exception = Thread.abort_on_exception, false + @connection = ActiveRecord::Base.connection @connection.transaction do @@ -25,6 +27,8 @@ module ActiveRecord teardown do @connection.drop_table "samples", if_exists: true + + Thread.abort_on_exception = @abort end test "raises SerializationFailure when a serialization failure occurs" do |