Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Introduce new ActiveRecord transaction error classes #25107
This is a WIP follow-up to #25093.
I went ahead with @jeremy's recommendation of introducing
Checked around, and it looks like MySQL is just returning an
thread = Thread.new do Sample.transaction isolation: :serializable do Sample.delete_all 10.times do |i| sleep 0.1 Sample.create value: i end end end sleep 0.1 Sample.transaction isolation: :serializable do Sample.delete_all 10.times do |i| sleep 0.1 Sample.create value: i end end thread.join
s1 = Sample.create value: 1 s2 = Sample.create value: 2 thread = Thread.new do Sample.transaction do s1.lock! sleep 1 s2.update_attributes value: 1 end end sleep 0.5 Sample.transaction do s2.lock! sleep 1 s1.update_attributes value: 2 end thread.join
Also checked MS SQL Server and Oracle and - like MySQL - they only have error mappings for
Also did a quick check and it seems like the MS SQL Server adapter is only translating deadlock errors - which is also
@jeremy Your thoughts? Can we proceed with this current set of changes?