Does anyone else have any input at this stage?? It seems to me that the most appropriate way forward is a documentation update which explains that get_or_create() is not atomically safe across all databases, and may need a commit() before hand, or a read isolation change (with warnings about both).
On Mon, Jul 16, 2012 at 10:06 PM, Anssi Kääriäinen <[email protected]>wrote: > On 16 heinä, 23:43, Ian Kelly <[email protected]> wrote: > > On Mon, Jul 16, 2012 at 2:18 PM, Cal Leeming [Simplicity Media Ltd] > > > > <[email protected]> wrote: > > > Okay - anyone else want to throw their thoughts at this? > > > > > Also - messing with the isolation levels on MySQL is really not a great > > > idea.. it can cause all sorts of unexpected behavior. > > > > Just a thought -- I don't have MySQL handy to test on, but what if the > > savepoint occurred before the first get instead of before the create? > > Would rolling back the savepoint then release the row lock and allow > > the second get to read the row? > > > > If this works but performance is an issue, then perhaps we could > > dynamically order the operations according to the known isolation > > level? > > Unfortunately this doesn't work. There is another ticket where this > was discussed. At first it seems to work, but it turns out that it > works only if the get_or_create is called as the first thing in the > query. See https://code.djangoproject.com/ticket/13906#comment:29 and > https://code.djangoproject.com/ticket/13906#comment:30 for details. > Basically MySQL in repeatable read isolation works weird in this case. > > - Anssi > > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/django-developers?hl=en. > > -- *Cal Leeming Technical Support | Simplicity Media Ltd **US *310-362-7070 | *UK *02476 100401 | *Direct *02476 100402 *Available 24 hours a day, 7 days a week.* -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
