#12579: QuerySet.get_or_create()'s behavior depends on database's uniqueness
restrictions
-------------------------------------+-------------------------------------
     Reporter:  timmolendijk         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Documentation        |                  Version:  1.0
     Severity:  Normal               |               Resolution:
     Keywords:  get_or_create        |             Triage Stage:  Accepted
  concurrency race unique            |      Needs documentation:  0
  documentation                      |  Patch needs improvement:  0
    Has patch:  0                    |                    UI/UX:  0
  Needs tests:  0                    |
Easy pickings:  1                    |
-------------------------------------+-------------------------------------

Comment (by jdunck):

 We (Votizen) were seeing the REPEATABLE READ visibility problem (described
 in the StackOverflow link above) on mysql+innodb+REPEATABLE READ.  To me,
 the suggestion on StackOverflow- of committing whatever transaction is
 pending - is bogus.  Transactions need to be composable, and committing so
 you can read means you can't combine this function with any other function
 that requires an ongoing transaction.

 We switched (about 6 months ago) to READ COMMITTED.  This reduces
 throughput in mysql, but is a good tradeoff to me.

 I think that since MySQL's innodb default transaction isolation is
 incompatible with Django's get_or_create approach, it would be good to
 either note in the docs for get_or_create, or advise setting READ
 COMMITTED for all users of mysql.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/12579#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" 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-updates?hl=en.

Reply via email to