<?xml version="1.0" encoding="UTF-8"?>
<ticket>
  <assigned-user-id type="integer">85</assigned-user-id>
  <attachments-count type="integer">4</attachments-count>
  <closed type="boolean">true</closed>
  <created-at type="datetime">2008-06-10T18:54:40+01:00</created-at>
  <creator-id type="integer">22887</creator-id>
  <milestone-due-on type="datetime">2009-01-31T00:00:00+00:00</milestone-due-on>
  <milestone-id type="integer" nil="true"></milestone-id>
  <number type="integer">383</number>
  <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
  <priority type="integer">21</priority>
  <project-id type="integer">8994</project-id>
  <raw-data type="binary" nil="true" encoding="base64"></raw-data>
  <state>committed</state>
  <tag>activerecord nested savepoint transaction</tag>
  <title>ActiveRecord should use savepoints for nested transactions</title>
  <updated-at type="datetime">2009-01-16T21:07:58+00:00</updated-at>
  <user-id type="integer">17202</user-id>
  <user-name>Greg</user-name>
  <creator-name>Sean Kirby</creator-name>
  <assigned-user-name>Jeremy Kemper</assigned-user-name>
  <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
  <original-body>From http://dev.rubyonrails.org/ticket/5457 in the old rails trac.

Jonathan Viney has created a patch that enables doesn't break existing transaction semantics but allows for transactional behaviour to be tested in transactional fixtures.

http://svn.viney.net.nz/things/rails/plugins/savepoints/</original-body>
  <latest-body>From http://dev.rubyonrails.org/ticket/5457 in the old rails trac.

Jonathan Viney has created a patch that enables doesn't break existing transaction semantics but allows for transactional behaviour to be tested in transactional fixtures.

http://svn.viney.net.nz/things/rails/plugins/savepoints/</latest-body>
  <original-body-html>&lt;div&gt;&lt;p&gt;
From &lt;a href=&quot;http://dev.rubyonrails.org/ticket/5457&quot;&gt;http://dev.rubyonrails.org/ticke...&lt;/a&gt; in the old rails trac.
&lt;/p&gt;&lt;p&gt;
Jonathan Viney has created a patch that enables doesn't break existing transaction semantics but allows for transactional behaviour to be tested in transactional fixtures.
&lt;/p&gt;&lt;p&gt;
&lt;a href=&quot;http://svn.viney.net.nz/things/rails/plugins/savepoints/&quot;&gt;http://svn.viney.net.nz/things/r...&lt;/a&gt;
&lt;/p&gt;&lt;/div&gt;</original-body-html>
  <versions type="array">
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>From http://dev.rubyonrails.org/ticket/5457 in the old rails trac.

Jonathan Viney has created a patch that enables doesn't break existing transaction semantics but allows for transactional behaviour to be tested in transactional fixtures.

http://svn.viney.net.nz/things/rails/plugins/savepoints/</body>
      <body-html>&lt;div&gt;&lt;p&gt;
From &lt;a href=&quot;http://dev.rubyonrails.org/ticket/5457&quot;&gt;http://dev.rubyonrails.org/ticke...&lt;/a&gt; in the old rails trac.
&lt;/p&gt;&lt;p&gt;
Jonathan Viney has created a patch that enables doesn't break existing transaction semantics but allows for transactional behaviour to be tested in transactional fixtures.
&lt;/p&gt;&lt;p&gt;
&lt;a href=&quot;http://svn.viney.net.nz/things/rails/plugins/savepoints/&quot;&gt;http://svn.viney.net.nz/things/r...&lt;/a&gt;
&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-06-10T18:54:40+01:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag nil="true"></tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2008-06-10T18:54:40+01:00</updated-at>
      <user-id type="integer">22887</user-id>
      <user-name>Sean Kirby</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>I'd love to support savepoints. We've had the discussion regarding the default behavior of nested transactions, though, and it's not the way to go. Nested transactions should be explicit, otherwise we're going to flood the database with junk transactions that really only mean &quot;include me in a transaction&quot; not &quot;start a new transaction&quot;. Let's extend the existing semantics instead of stepping on them. And add better test coverage ;)</body>
      <body-html>&lt;div&gt;&lt;p&gt;
I'd love to support savepoints. We've had the discussion regarding the default behavior of nested transactions, though, and it's not the way to go. Nested transactions should be explicit, otherwise we're going to flood the database with junk transactions that really only mean &quot;include me in a transaction&quot; not &quot;start a new transaction&quot;. Let's extend the existing semantics instead of stepping on them. And add better test coverage ;)
&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-06-10T22:35:35+01:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- 
:assigned_user: 
</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag nil="true"></tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2008-06-10T22:35:35+01:00</updated-at>
      <user-id type="integer">85</user-id>
      <user-name>Jeremy Kemper</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body></body>
      <body-html></body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-06-10T22:35:49+01:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- 
:milestone: 
</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag nil="true"></tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2008-06-10T22:35:49+01:00</updated-at>
      <user-id type="integer">85</user-id>
      <user-name>Jeremy Kemper</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Jeremy, the plugin by Jonathan Viney actually does make transaction{} only create a nested transaction if an explicit &quot;:force =&gt; true&quot; option is passed to it. The only exception being transactional tests where one additional level of non-explicit transactions can be created (because the test class itself uses the first level).

So these changes should not change rails behavior outside tests.

This plugin however does not include the ability to configure rails behavior for implicit transactions (those automatically created by save/destroy). Which means that you will not be able to make some activerecord model always create an implicit transaction for saving itself, even if a higher level transaction already exists. But this is a capability not strictly neccessary for the nested transactions feature to be useful, as you can always create an explicit &quot;transaction :force =&gt; true&quot; block around a save if you need it.</body>
      <body-html>&lt;div&gt;&lt;p&gt;
Jeremy, the plugin by Jonathan Viney actually does make transaction{} only create a nested transaction if an explicit &quot;:force =&gt; true&quot; option is passed to it. The only exception being transactional tests where one additional level of non-explicit transactions can be created (because the test class itself uses the first level).
&lt;/p&gt;&lt;p&gt;
So these changes should not change rails behavior outside tests.
&lt;/p&gt;&lt;p&gt;
This plugin however does not include the ability to configure rails behavior for implicit transactions (those automatically created by save/destroy). Which means that you will not be able to make some activerecord model always create an implicit transaction for saving itself, even if a higher level transaction already exists. But this is a capability not strictly neccessary for the nested transactions feature to be useful, as you can always create an explicit &quot;transaction :force =&gt; true&quot; block around a save if you need it.
&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-06-16T20:02:06+01:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag nil="true"></tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2008-06-16T20:02:06+01:00</updated-at>
      <user-id type="integer">14890</user-id>
      <user-name>Tarmo T&#228;nav</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>I'd like to see #533 included first (moving the transaction counter from Thread.current to the connection object), and then I'll add an updated patch for the savepoints.</body>
      <body-html>&lt;div&gt;&lt;p&gt;
I'd like to see &lt;a href=&quot;/projects/8994/tickets/533&quot; title=&quot;Ticket #533&quot;&gt;#533&lt;/a&gt; included first (moving the transaction counter from Thread.current to the connection object), and then I'll add an updated patch for the savepoints.
&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-07-03T13:12:57+01:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- 
:tag: 
</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>activerecord nested savepoint transaction</tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2008-07-03T13:12:57+01:00</updated-at>
      <user-id type="integer">17814</user-id>
      <user-name>jonathan</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>#533 is in -- interested in porting your work over to Rails master?</body>
      <body-html>&lt;div&gt;&lt;p&gt;&lt;a href=&quot;/projects/8994/tickets/533&quot; title=&quot;Ticket #533&quot;&gt;#533&lt;/a&gt; is in -- interested in porting your work
over to Rails master?&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-08-30T05:10:22+01:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- 
:state: new
</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions-2</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>open</state>
      <tag>activerecord nested savepoint transaction</tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2008-08-30T05:10:22+01:00</updated-at>
      <user-id type="integer">85</user-id>
      <user-name>Jeremy Kemper</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>I've attached a patch for master.

The handling of increment/decrement_open_transactions has been moved to the connection object rather than handling it in AR::Base.transaction, seemed better to me.

I've added a transactional_fixtures accessor to the connection which is set by the fixtures. Not the nicest, but I wasn't sure what else to do.

There are some failures for databases that don't support savepoints (eg. sqlite). These are a bit hard to avoid unless we add a supports_savepoints? to the connection.

Anyway, this should get the ball rolling.</body>
      <body-html>&lt;div&gt;&lt;p&gt;I've attached a patch for master.&lt;/p&gt;
&lt;p&gt;The handling of increment/decrement_open_transactions has been
moved to the connection object rather than handling it in
AR::Base.transaction, seemed better to me.&lt;/p&gt;
&lt;p&gt;I've added a transactional_fixtures accessor to the connection
which is set by the fixtures. Not the nicest, but I wasn't sure
what else to do.&lt;/p&gt;
&lt;p&gt;There are some failures for databases that don't support
savepoints (eg. sqlite). These are a bit hard to avoid unless we
add a supports_savepoints? to the connection.&lt;/p&gt;
&lt;p&gt;Anyway, this should get the ball rolling.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-08-31T11:38:50+01:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions-3</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>open</state>
      <tag>activerecord nested savepoint transaction</tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2008-08-31T11:38:50+01:00</updated-at>
      <user-id type="integer">17814</user-id>
      <user-name>jonathan</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>I think ':force =&gt; true' is a bit confusing. How about ':nested =&gt; true'?</body>
      <body-html>&lt;div&gt;&lt;p&gt;I think ':force =&amp;gt; true' is a bit confusing. How about
':nested =&amp;gt; true'?&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-10-01T15:19:19+01:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>open</state>
      <tag>activerecord nested savepoint transaction</tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2008-10-01T15:19:22+01:00</updated-at>
      <user-id type="integer">10679</user-id>
      <user-name>Hongli Lai</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>savepoints-3.diff doesn't apply cleanly om master. Here's an updated patch, with conflicts resolved.

It doesn't pass the unit tests however. More investigation will be required.</body>
      <body-html>&lt;div&gt;&lt;p&gt;savepoints-3.diff doesn't apply cleanly om master. Here's an
updated patch, with conflicts resolved.&lt;/p&gt;
&lt;p&gt;It doesn't pass the unit tests however. More investigation will
be required.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-10-09T12:22:35+01:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>open</state>
      <tag>activerecord nested savepoint transaction</tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2008-10-09T12:22:38+01:00</updated-at>
      <user-id type="integer">10679</user-id>
      <user-name>Hongli Lai</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">2</attachments-count>
      <body>Jonathan, is there a reason why you changed

    def transaction(start_db_transaction = false)

to

    def transaction(start_db_transaction = false)

?</body>
      <body-html>&lt;div&gt;&lt;p&gt;Jonathan, is there a reason why you changed&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;def transaction(start_db_transaction = false)
&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;to&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;def transaction(start_db_transaction = false)
&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;?&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-10-09T12:25:37+01:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>open</state>
      <tag>activerecord nested savepoint transaction</tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2008-10-09T12:25:42+01:00</updated-at>
      <user-id type="integer">10679</user-id>
      <user-name>Hongli Lai</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">2</attachments-count>
      <body>Never mind my last message, I already figured it out. :)

Here's an updated patch which passes all unit tests, for MySQL, PostgreSQL and SQLite3. Changes are:

* Much improved documentation, including documentation about potential caveats on MySQL.
* :force option renamed to :nest, which is probably clearer.
* I had to revert commit 045713ee240fff815edb5962b25d668512649478 by Jeremy Kemper, &quot;PostgreSQL: introduce transaction_active? rather than tracking activity ourselves&quot;. It conflicts with the savepoint code.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Never mind my last message, I already figured it out. :)&lt;/p&gt;
&lt;p&gt;Here's an updated patch which passes all unit tests, for MySQL,
PostgreSQL and SQLite3. Changes are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Much improved documentation, including documentation about
potential caveats on MySQL.&lt;/li&gt;
&lt;li&gt;:force option renamed to :nest, which is probably clearer.&lt;/li&gt;
&lt;li&gt;I had to revert commit 045713ee240fff815edb5962b25d668512649478
by Jeremy Kemper, &quot;PostgreSQL: introduce transaction_active? rather
than tracking activity ourselves&quot;. It conflicts with the savepoint
code.&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-10-09T15:27:43+01:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>open</state>
      <tag>activerecord nested savepoint transaction</tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2008-10-09T15:27:48+01:00</updated-at>
      <user-id type="integer">10679</user-id>
      <user-name>Hongli Lai</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">3</attachments-count>
      <body>After speaking with Koz I've reimplemented Jeremy's transaction state introspection feature. The old implementation was incompatible with the old 'postgres' driver, which I fixed. I also added unit tests for this feature.</body>
      <body-html>&lt;div&gt;&lt;p&gt;After speaking with Koz I've reimplemented Jeremy's transaction
state introspection feature. The old implementation was
incompatible with the old 'postgres' driver, which I fixed. I also
added unit tests for this feature.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-10-09T17:00:49+01:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>open</state>
      <tag>activerecord nested savepoint transaction</tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2008-10-09T17:00:56+01:00</updated-at>
      <user-id type="integer">10679</user-id>
      <user-name>Hongli Lai</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">4</attachments-count>
      <body>Koz said that it's probably not feasible to include this feature in 2.2, seeing that we're in a feature freeze. If anybody wants to help, I'm maintaining this savepoint stuff in the following git repository:

git://git.phusion.nl/rails.git
branch 'savepoints'</body>
      <body-html>&lt;div&gt;&lt;p&gt;Koz said that it's probably not feasible to include this feature
in 2.2, seeing that we're in a feature freeze. If anybody wants to
help, I'm maintaining this savepoint stuff in the following git
repository:&lt;/p&gt;
&lt;p&gt;git://git.phusion.nl/rails.git branch 'savepoints'&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-10-09T17:18:56+01:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>open</state>
      <tag>activerecord nested savepoint transaction</tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2008-10-09T17:19:01+01:00</updated-at>
      <user-id type="integer">10679</user-id>
      <user-name>Hongli Lai</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">4</attachments-count>
      <body></body>
      <body-html></body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-10-17T17:14:35+01:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- 
:milestone: 12671
</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>open</state>
      <tag>activerecord nested savepoint transaction</tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2008-10-17T17:14:41+01:00</updated-at>
      <user-id type="integer">1366</user-id>
      <user-name>Pratik</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">4</attachments-count>
      <body></body>
      <body-html></body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-12-03T19:08:41+00:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- 
:milestone: 9903
</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>open</state>
      <tag>activerecord nested savepoint transaction</tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2008-12-03T19:08:45+00:00</updated-at>
      <user-id type="integer">141</user-id>
      <user-name>Michael Koziarski</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
      <milestone-title nil="true"></milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">4</attachments-count>
      <body>Is git://git.phusion.nl/rails.git still available?</body>
      <body-html>&lt;div&gt;&lt;p&gt;Is git://git.phusion.nl/rails.git still available?&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-12-09T00:00:53+00:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>open</state>
      <tag>activerecord nested savepoint transaction</tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2008-12-09T00:00:57+00:00</updated-at>
      <user-id type="integer">85</user-id>
      <user-name>Jeremy Kemper</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
      <milestone-title nil="true"></milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">4</attachments-count>
      <body>Yes it is. I've just merged the patches against latest edge, and all unit tests pass.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Yes it is. I've just merged the patches against latest edge, and
all unit tests pass.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-12-09T00:45:45+00:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>open</state>
      <tag>activerecord nested savepoint transaction</tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2008-12-09T00:45:49+00:00</updated-at>
      <user-id type="integer">10679</user-id>
      <user-name>Hongli Lai</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
      <milestone-title nil="true"></milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">4</attachments-count>
      <body>@@@
$ git remote add phusion git://git.phusion.nl/rails.git
$ git fetch phusion
fatal: The remote end hung up unexpectedly
@@@</body>
      <body-html>&lt;div&gt;&lt;pre&gt;&lt;code&gt;
$ git remote add phusion git://git.phusion.nl/rails.git
$ git fetch phusion
fatal: The remote end hung up unexpectedly
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-12-09T02:40:54+00:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>open</state>
      <tag>activerecord nested savepoint transaction</tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2008-12-09T02:40:56+00:00</updated-at>
      <user-id type="integer">85</user-id>
      <user-name>Jeremy Kemper</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
      <milestone-title nil="true"></milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">4</attachments-count>
      <body>Oops, a little git-daemon configuration problem, sorry. It should be up now.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Oops, a little git-daemon configuration problem, sorry. It
should be up now.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-12-09T11:24:21+00:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>open</state>
      <tag>activerecord nested savepoint transaction</tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2008-12-09T11:24:23+00:00</updated-at>
      <user-id type="integer">10679</user-id>
      <user-name>Hongli Lai</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
      <milestone-title nil="true"></milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">4</attachments-count>
      <body>@@@ ruby
     def transaction(start_db_transaction = false)
       start_db_transaction ||= open_transactions == 0 || (open_transactions == 1 &amp;&amp; transactional_fixtures)
@@@

This is an unexpected change of behavior: your transactions are nested in tests by default, but not in development or production without :nest =&gt; true.

There should be a clearer distinction between wanting to participate in a transaction and requiring a new transaction boundary.

To keep Base#transaction compatible with existing apps, we should :nest =&gt; true by default but disable for save/destroy callback transactions.</body>
      <body-html>&lt;div&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
     def transaction(start_db_transaction = false)
       start_db_transaction ||= open_transactions == 0 || (open_transactions == 1 &amp;amp;&amp;amp; transactional_fixtures)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is an unexpected change of behavior: your transactions are
nested in tests by default, but not in development or production
without :nest =&amp;gt; true.&lt;/p&gt;
&lt;p&gt;There should be a clearer distinction between wanting to
participate in a transaction and requiring a new transaction
boundary.&lt;/p&gt;
&lt;p&gt;To keep Base#transaction compatible with existing apps, we
should :nest =&amp;gt; true by default but disable for save/destroy
callback transactions.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-01-10T20:50:59+00:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>open</state>
      <tag>activerecord nested savepoint transaction</tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2009-01-10T20:51:02+00:00</updated-at>
      <user-id type="integer">85</user-id>
      <user-name>Jeremy Kemper</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
      <milestone-title nil="true"></milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">4</attachments-count>
      <body>http://github.com/rails/rails/commit/ab0ce052ba23a4cce7a84ecade0d00d9cc518ebd</body>
      <body-html>&lt;div&gt;&lt;p&gt;&lt;a href=&quot;http://github.com/rails/rails/commit/ab0ce052ba23a4cce7a84ecade0d00d9cc518ebd&quot;&gt;
http://github.com/rails/rails/co...&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2009-01-10T23:13:55+00:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- 
:state: open
</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>committed</state>
      <tag>activerecord nested savepoint transaction</tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2009-01-10T23:13:59+00:00</updated-at>
      <user-id type="integer">85</user-id>
      <user-name>Jeremy Kemper</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
      <milestone-title nil="true"></milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">4</attachments-count>
      <body>(from [ab0ce052ba23a4cce7a84ecade0d00d9cc518ebd]) Introduce transaction_joinable flag to mark that the fixtures transaction can't joined, a new savepoint is required even if :requires_new is not set. Use :requires_new option instead of :nest. Update changelog.

[#383 state:committed]
http://github.com/rails/rails/commit/ab0ce052ba23a4cce7a84ecade0d00d9cc518ebd</body>
      <body-html>&lt;div&gt;&lt;p&gt;(from [ab0ce052ba23a4cce7a84ecade0d00d9cc518ebd]) Introduce
transaction_joinable flag to mark that the fixtures transaction
can't joined, a new savepoint is required even if :requires_new is
not set. Use :requires_new option instead of :nest. Update
changelog.&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;/projects/8994/tickets/383&quot; title=&quot;Ticket #383&quot;&gt;#383&lt;/a&gt; state:committed] &lt;a href=&quot;http://github.com/rails/rails/commit/ab0ce052ba23a4cce7a84ecade0d00d9cc518ebd&quot;&gt;
http://github.com/rails/rails/co...&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2009-01-10T23:30:45+00:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>committed</state>
      <tag>activerecord nested savepoint transaction</tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2009-01-10T23:30:46+00:00</updated-at>
      <user-id type="integer">17393</user-id>
      <user-name>Repository</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
      <milestone-title nil="true"></milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">85</assigned-user-id>
      <attachments-count type="integer">4</attachments-count>
      <body>Can we ensure there's a way to easily debug issues one has when using the feature.  I'm thinking of setting out the development database logs with the SQL trace in a fashion where it's easy to see what:
(a) transaction it's part of 
(b) what save point section it's part of (if that makes sense)</body>
      <body-html>&lt;div&gt;&lt;p&gt;Can we ensure there's a way to easily debug issues one has when
using the feature. I'm thinking of setting out the development
database logs with the SQL trace in a fashion where it's easy to
see what: (a) transaction it's part of (b) what save point section
it's part of (if that makes sense)&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2009-01-16T21:07:53+00:00</created-at>
      <creator-id type="integer">22887</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">383</number>
      <permalink>activerecord-should-use-savepoints-for-nested-transactions</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>committed</state>
      <tag>activerecord nested savepoint transaction</tag>
      <title>ActiveRecord should use savepoints for nested transactions</title>
      <updated-at type="datetime">2009-01-16T21:07:58+00:00</updated-at>
      <user-id type="integer">17202</user-id>
      <user-name>Greg</user-name>
      <creator-name>Sean Kirby</creator-name>
      <assigned-user-name>Jeremy Kemper</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/383</url>
      <milestone-title nil="true"></milestone-title>
    </version>
  </versions>
  <attachments type="array">
    <attachment type="Attachment">
      <code>c4a2d136fdcaa16b98fdec8ede0e52d21be74f5d</code>
      <content-type>text/plain</content-type>
      <created-at type="datetime">2008-08-31T11:38:50+01:00</created-at>
      <filename>savepoints-3.diff</filename>
      <height type="integer" nil="true"></height>
      <id type="integer">42811</id>
      <size type="integer">14985</size>
      <uploader-id type="integer">17814</uploader-id>
      <width type="integer" nil="true"></width>
      <url>http://rails.lighthouseapp.com/attachments/42811/savepoints-3.diff</url>
    </attachment>
    <attachment type="Attachment">
      <code>b8c27ff0dcc30f77e4005e625b54915f1d22a605</code>
      <content-type>text/plain</content-type>
      <created-at type="datetime">2008-10-09T12:22:36+01:00</created-at>
      <filename>savepoints-4.diff</filename>
      <height type="integer" nil="true"></height>
      <id type="integer">52735</id>
      <size type="integer">14940</size>
      <uploader-id type="integer">10679</uploader-id>
      <width type="integer" nil="true"></width>
      <url>http://rails.lighthouseapp.com/attachments/52735/savepoints-4.diff</url>
    </attachment>
    <attachment type="Attachment">
      <code>5b7410738809c89635bd4e0ebeccdad07913c4bb</code>
      <content-type>text/plain</content-type>
      <created-at type="datetime">2008-10-09T15:27:43+01:00</created-at>
      <filename>savepoints-5.diff</filename>
      <height type="integer" nil="true"></height>
      <id type="integer">52774</id>
      <size type="integer">39922</size>
      <uploader-id type="integer">10679</uploader-id>
      <width type="integer" nil="true"></width>
      <url>http://rails.lighthouseapp.com/attachments/52774/savepoints-5.diff</url>
    </attachment>
    <attachment type="Attachment">
      <code>8b78d68d0069d2e783e5972c0a39a46c40cf5f92</code>
      <content-type>text/plain</content-type>
      <created-at type="datetime">2008-10-09T17:00:49+01:00</created-at>
      <filename>savepoints-6.diff</filename>
      <height type="integer" nil="true"></height>
      <id type="integer">52798</id>
      <size type="integer">45558</size>
      <uploader-id type="integer">10679</uploader-id>
      <width type="integer" nil="true"></width>
      <url>http://rails.lighthouseapp.com/attachments/52798/savepoints-6.diff</url>
    </attachment>
  </attachments>
</ticket>
