Weakness of Transaction in Rails

Dear All:

I have done my test for 2 actions do simultaneously for the same command. Here is my approvement.

CORRECTION TABLE :

You need locking, not transactions. the problem is that both scripts load the initial version (ie with quantity = 10). when the second one completes it ignores the changes made by the first one.

Fred

Thanks my bro, fred. Here is my second experiment

Are you tables MyISAM? MyISAM tables don't support transactions or row level locks (AR's optimistic locking is probably a better fit for this anyway) so this would be entirely surprising (but using transactions is necessary for pessimistic locking; the lock is held for the duration of the current transaction

Fred

Yes it is ENGINE=MyISAM :((

How I can move it? I use SQLYOG and XAMP, it says ENGINE=MyISAM, MySQL GUI v5.14.

Thank you, Reinhart

set it to innodb. No idea what SQLYOG or XAMP are. Also I noticed that for some reason you're doing this from unit tests which (normally) destroy and reload the test database each time you run them

Fred

What is the best way to test it out of unit test? Thank you.

I cant find to convert MyISAM to InnoDB fast and safety. I have lot of table tobe converted, any suggestion?

Thanks, Reinhart

See the MySQL doc for ALTER TABLE

ALTER TABLE items ENGINE=INNODB

Not work, I use phpMyAdmin at XAMP and SQLYOG

script/runner for example or just require boot.rb and environment.rb

Fred