[Dbix-class] is it safe use find_or_create in "read committed"
transaction level
Wei Gui
guienator at gmail.com
Mon Sep 20 04:08:54 GMT 2010
I start use DBIx in my project. and I read this from
DBIx::Class::ResultSet document
>> Note: Because find_or_create() reads from the database and then possibly inserts based on the result, this method is subject to a race condition. Another process could create a record in the table after the find has completed and before the create has started. To avoid this problem, use find_or_create() inside a transaction.
IMO, put find_or_create inside a transaction only works if the
transaction level is serializable. But for Oracle whose default
transaction level is "read committed", which means race condition in
find_or_create may still happen even in a transaction.
Can someone confirm it. if it is true, how use DBIx handle it
thanks,
More information about the DBIx-Class
mailing list