diff options
author | Matthew Draper <matthew@trebex.net> | 2017-04-25 17:44:54 -0700 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2017-04-25 17:47:44 -0700 |
commit | deba47799ff905f778e0c98a015789a1327d5087 (patch) | |
tree | 75e5b97b445ff98259e772bb9f1193d6810a6db1 /guides/source | |
parent | a3c7fe06be9d5e69656a4f196f6de6f1cd623f96 (diff) | |
download | rails-deba47799ff905f778e0c98a015789a1327d5087.tar.gz rails-deba47799ff905f778e0c98a015789a1327d5087.tar.bz2 rails-deba47799ff905f778e0c98a015789a1327d5087.zip |
Describe the changes in transactional tests
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/5_1_release_notes.md | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md index ffa18f1a2b..a0fa1680c4 100644 --- a/guides/source/5_1_release_notes.md +++ b/guides/source/5_1_release_notes.md @@ -225,6 +225,37 @@ can generate form tags based on URLs, scopes or models. </form> ``` +Incompatibilities +----------------- + +The following changes may require immediate action upon upgrade. + +### Transactional tests with multiple connections + +Transactional tests now wrap all Active Record connections in database +transactions. + +When a test spawns additional threads, and those threads obtain database +connections, those connections are now handled specially: + +The threads will share a single connection, which is inside the managed +transaction. This ensures all threads see the database in the same +state, ignoring the outermost transaction. Previously, such additional +connections were unable to see the fixture rows, for example. + +When a thread enters a nested transaction, it will temporarily obtain +exclusive use of the connection, to maintain isolation. + +If your tests currently rely on obtaining a separate, +outside-of-transaction, connection in a spawned thread, you'll need to +switch to more explicit connection management. + +If your tests spawn threads and those threads interact while also using +explicit database transactions, this change may introduce a deadlock. + +The easy way to opt out of this new behavior is to disable transactional +tests on any test cases it affects. + Railties -------- |