Re: [Rails-core] Re: ActiveRecord::Persistence.increment! requires a row lock to ensure isolated updates

2013-01-23 Thread Gabriel Sobrinho
It makes sense! I have a debt entity in my application and payments this entity can happen three or more times in parallel (stupid brazilian banks, don't ask me why they do it). Since I have to keep a cache column of the paid value for the debt, I have 25 workers (sidekiq) that can call

Re: [Rails-core] Re: ActiveRecord::Persistence.increment! requires a row lock to ensure isolated updates

2013-01-23 Thread Matt Jones
On Jan 23, 2013, at 4:03 AM, Gabriel Sobrinho wrote: It makes sense! I have a debt entity in my application and payments this entity can happen three or more times in parallel (stupid brazilian banks, don't ask me why they do it). Since I have to keep a cache column of the paid value

Re: [Rails-core] ActiveRecord::Persistence.increment! requires a row lock to ensure isolated updates

2013-01-23 Thread Gabriel Sobrinho
Yes, I'm thinking about that and seems there is no way to handle this in a smart way. Developers can think from what reason I've incremented by 100 and it incremented by 300 until he figure out that was incremented by other threads too. Maybe some documentation on increment(!)/decrement(!)

Re: [Rails-core] ActiveRecord::Persistence.increment! requires a row lock to ensure isolated updates

2013-01-23 Thread Carlos Antonio da Silva
If this is indeed your use case, what I'm advocating here is much simpler than that. I just want to be able to increment numeric columns in active record without declaring them as counter cache columns. You should still be able to do that by calling increment_counter or update_counters