search for: updatelockforfoo

Displaying 1 result from an estimated 1 matches for "updatelockforfoo".

2012 Apr 02
10
Pessimistic locking locks the entire table?
Hi guys, I must be missing something obvious with pessimistic locking. Here is what I do (Rails 2.3, mySQL): In my Foo model: def test Foo.transaction do lock = UpdateLockForFoo.find_by_foo_id(self.id, :lock => true) sleep 30 end end For each Foo model, I have an UpdateLockForFoo. This "lock" needs to be acquired before doing any changes to Foo. I believe it works, except that my entire UpdateLockForFoo table is blocked during the sleep. If I open two...