Some non-transactional changed tables couldn't be rolled back

Posted on Sat Mar 04 15:36:00 UTC 2006

Here’s an other thing that is not supposed to happen, but invariably does.

Playing aroung with Unit Testing in Rails (you are using them, right?), one test fails with:

Exception `ActiveRecord::StatementInvalid’ at
…/active_record/connection_adapters/mysql_adapter.rb:185 
- Mysql::Error: Warning:  Some non-transactional changed
tables couldn’t be rolled back: ROLLBACK

Turns out that on my OS (debian), the default mysql database table type is MyISAM and it does not support ROLLBACK, try InnoDB instead.

March 12, 2006 update:

In case this is not possible, or too much problem, there is an other solution (albeit slower).

In test/test_helper.rb, change:

self.use_transactional_fixtures = true

to

self.use_transactional_fixtures = false

this way, the testing framework won’t use rollback but drop and recreate the tables each time (which explains why this is slower).

Posted in Quid Pro Quo  |  Tags , ,  |  2 comments

Comments

  1. Bakka Bakka said // Dec 05, 2008 at 08:07 AM

    Thanks man, I changed the engine to InnoDB and now it works fine. Does that make the table size bigger by the way?

  2. Pascal Pascal said // Dec 05, 2008 at 10:45 PM

    Not sure it impacts size too much, at least not in a meaningful way. However, the performance characteristics may be different. See http://low.cc/t2TGt

(leave url/email »)

Comment Markup Help