- 13 7月, 2016 1 次提交
-
-
由 Jeremy Wadsack 提交于
loaded model classes have their connections wrapped in transactions. See #17776 In Rails 4 config.eager_load was changed to false in the test environment. This means that model classes that connect to alternate databases with establish_connection are not loaded at start up. If use_transactional_fixtures is enabled, transactions are wrapped around the connections that have been established only at the start of the test suite. So model classes loaded later don't have transactions causing data created in the alternate database not to be removed. This change resolves that by creating a new connection.active_record notification that gets fired whenever a connection is established. I then added a subscriber after we set up transactions in the test environment to listen for additional connections and wrap those in transactions as well.
-
- 06 7月, 2016 1 次提交
-
-
由 Matthew Draper 提交于
-
- 06 5月, 2016 2 次提交
-
-
由 Arthur Neves 提交于
-
由 Arthur Neves 提交于
ConnectionHandler will not have any knowlodge of AR models now, it will only know about the specs. Like that we can decouple the two, and allow the same model to use more than one connection. Historically, folks used to create abstract AR classes on the fly in order to have multiple connections for the same model, and override the connection methods. With this, now we can override the `specificiation_id` method in the model, to return a key, that will be used to find the connection_pool from the handler.
-
- 05 11月, 2015 1 次提交
-
-
由 Jerry D'Antonio 提交于
-
- 14 7月, 2015 1 次提交
-
-
由 Jerry D'Antonio 提交于
The concurrent-ruby gem is a toolset containing many concurrency utilities. Many of these utilities include runtime-specific optimizations when possible. Rather than clutter the Rails codebase with concurrency utilities separate from the core task, such tools can be superseded by similar tools in the more specialized gem. This commit replaces `ActiveSupport::Concurrency::Latch` with `Concurrent::CountDownLatch`, which is functionally equivalent.
-
- 18 5月, 2015 1 次提交
-
-
由 Matthew Draper 提交于
We must account for receiving one less call to #new_connection, but the test otherwise remains valid.
-
- 14 5月, 2015 2 次提交
-
-
由 thedarkone 提交于
Renamed `@reserved_connections` -> `@thread_cached_conns`. New name clearly conveys the purpose of the cache, which is to speed-up `#connection` method. The new `@thread_cached_conns` now also uses `Thread` objects as keys (instead of previously `Thread.current.object_id`). Since there is no longer any synchronization around `@thread_cached_conns`, `disconnect!` and `clear_reloadable_connections!` methods now pre-emptively obtain ownership (via `checkout`) of all existing connections, before modifying internal data structures. A private method `release` has been renamed `thread_conn_uncache` to clear-up its purpose. Fixed some brittle `thread.status == "sleep"` tests (threads can go into sleep even without locks).
-
由 thedarkone 提交于
-
- 29 4月, 2015 1 次提交
-
-
由 Eugene Kenny 提交于
The `db:schema:cache:dump` rake task dumps the database schema structure to `db/schema_cache.dump`. If this file is present, the schema details are loaded into the currently checked out connection by a railtie while Rails is booting, to avoid having to query the database for its schema. The schema cache dump is only applied to the initial connection used to boot the application though; other connections from the same pool are created with an empty schema cache, and still have to load the structure of each table directly from the database. With this change, a copy of the schema cache is associated with the connection pool and applied to connections as they are created.
-
- 15 4月, 2015 1 次提交
-
-
由 Jon Atack 提交于
This is a squash of the following commits, from first to last: - Fix minor, random things I’ve come across lately that individually did not seem worth making a PR for, so I saved them for one commit. One common error is using “it’s” (which is an abbreviation of “it is”) when the possessive “its” should be used for indicating possession. - Changes include the name of a test, so remove the `[skip ci]` (thanks @senny). - Line wrap the changes at 80 chars and add one more doc fix. - Add a missing line wrap in the Contributing to Ruby on Rails Guide. - Line wrap the `TIP` section in the Contributing to Ruby on Rails Guide as well. Rendering the guide locally with `bundle exec rake guides:generate` did not show any change in on-screen formatting after adding the line wrap. The HTML generated is (extra line added to illustrate where the line wrap takes place): <div class="info"><p>Please squash your commits into a single commit when appropriate. This simplifies future cherry picks and also keeps the git log clean.</p></div> - Squash commits.
-
- 18 3月, 2014 3 次提交
-
-
由 Aaron Patterson 提交于
Previously, any of the connection checkouts could have failed, and this test would pass.
-
由 Aaron Patterson 提交于
-
由 Matthew Draper 提交于
.. not a general timeout. Now, if a thread checks out a connection then dies, we can immediately recover that connection and re-use it. This should alleviate the pool exhaustion discussed in #12867. More importantly, it entirely avoids the potential issues of the reaper attempting to check whether connections are still active: as long as the owning thread is alive, the connection is its business alone. As a no-op reap is now trivial (only entails checking a thread status per connection), we can also perform one in-line any time we decide to sleep for a connection.
-
- 15 3月, 2014 1 次提交
-
-
由 Guo Xiang Tan 提交于
Follow-Up to https://github.com/rails/rails/pull/14348 Ensure that SQLCounter.clear_log is called after each test. This is a step to prevent side effects when running tests. This will allow us to run them in random order.
-
- 09 2月, 2014 1 次提交
-
-
由 Kevin Casey 提交于
-
- 09 7月, 2013 1 次提交
-
-
由 Aaron Patterson 提交于
-
- 15 6月, 2013 1 次提交
-
-
由 Angelo Capilleri 提交于
-
- 14 3月, 2013 1 次提交
-
-
由 Vipul A M 提交于
-
- 22 1月, 2013 1 次提交
-
-
由 Rafael Mendonça França 提交于
[ci skip]
-
- 20 1月, 2013 1 次提交
-
-
由 David 提交于
-
- 11 9月, 2012 1 次提交
-
-
由 Jonathan Rochkind 提交于
As a result of different commits, ConnectionPool had become of two minds about exceptions, sometimes using PoolFullError and sometimes using ConnectionTimeoutError. In fact, it was using ConnectionTimeoutError internally, but then recueing and re-raising as a PoolFullError. There's no reason for this bifurcation, standardize on ConnectionTimeoutError, which is the rails2 name and still accurately describes semantics at this point. History In Rails2, ConnectionPool raises a ConnectionTimeoutError if it can't get a connection within timeout. Originally in master/rails3, @tenderlove had planned on removing wait/blocking in connectionpool entirely, at that point he changed exception to PoolFullError. But then later wait/blocking came back, but exception remained PoolFullError. Then in 02b23355 pmahoney introduced fair waiting logic, and brought back ConnectionTimeoutError, introducing the weird bifurcation. ConnectionTimeoutError accurately describes semantics as of this point, and is backwards compat with rails2, there's no reason for PoolFullError to be introduced, and no reason for two different exception types to be used internally, no reason to rescue one and re-raise as another. Unify!
-
- 12 6月, 2012 1 次提交
-
-
由 Rafael Mendonça França 提交于
-
- 26 5月, 2012 1 次提交
-
-
由 Patrick Mahoney 提交于
The core of this fix is a threadsafe, fair Queue class. It is very similar to Queue in stdlib except that it supports waiting with a timeout. The issue this solves is that if several threads are contending for database connections, an unfair queue makes is possible that a thread will timeout even while other threads successfully acquire and release connections. A fair queue means the thread that has been waiting the longest will get the next available connection. This includes a few test fixes to avoid test ordering issues that cropped up during development of this patch.
-
- 24 5月, 2012 1 次提交
-
-
由 Jonathan Rochkind 提交于
An AR ConnectionSpec `wait_timeout` is pre-patch used for three different things: * mysql2 uses it for MySQL's own wait_timeout (how long MySQL should allow an idle connection before closing it), and defaults to 2592000 seconds. * ConnectionPool uses it for "number of seconds to block and wait for a connection before giving up and raising a timeout error", default 5 seconds. * ConnectionPool uses it for the Reaper, for deciding if a 'dead' connection can be reaped. Default 5 seconds. Previously, if you want to change these from defaults, you need to change them all together. This is problematic _especially_ for the mysql2/ConnectionPool conflict, you will generally _not_ want them to be the same, as evidenced by their wildly different defaults. This has caused real problems for people #6441 #2894 But as long as we're changing this, forcing renaming the ConnectionPool key to be more specific, it made sense to seperate the two ConnectionPool uses too -- these two types of ConnectionPool timeouts ought to be able to be changed independently, you won't neccesarily want them to be the same, even though the defaults are (currently) the same.
-
- 23 5月, 2012 1 次提交
-
-
由 Rafael Mendonça França 提交于
This reverts commit d2901f0f, reversing changes made to 525839fd. Conflicts: activerecord/test/cases/connection_pool_test.rb Reason: This change broke the build (http://travis-ci.org/#!/rails/rails/builds/1391490) and we don't have any solution until now. I asked the author to try to fix it and open a new pull request.
-
- 22 5月, 2012 1 次提交
-
-
由 Carlos Antonio da Silva 提交于
These variables were issuing some "not used" warnings.
-
- 21 5月, 2012 1 次提交
-
-
由 Patrick Mahoney 提交于
-
- 16 4月, 2012 1 次提交
-
-
由 Aaron Patterson 提交于
-
- 13 3月, 2012 1 次提交
-
-
由 Aaron Patterson 提交于
-
- 09 3月, 2012 2 次提交
-
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
make active_connection? return true only if there is an open connection in use for the current thread. fixes #5330
-
- 04 1月, 2012 1 次提交
-
-
由 Aaron Patterson 提交于
-
- 31 12月, 2011 6 次提交
-
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
-
- 30 11月, 2011 1 次提交
-
-
由 Aaron Patterson 提交于
the following code is deprecated: Thread.new { Post.find(1) }.join It should be changed to close the database connection at the end of the thread: Thread.new { Post.find(1) Post.connection.close }.join Only people who spawn threads in their application code need to worry about this change.
-