in Quid Pro Quo

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

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).

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

Comments are closed.