#13906: REPEATABLE READ (as used by default on MySQL) breaks atleast
QuerySet.get_or_create().
-------------------------------------+-------------------------------------
               Reporter:             |          Owner:
  sebastian_noack                    |         Status:  new
                   Type:             |      Component:  Database layer
  Cleanup/optimization               |  (models, ORM)
              Milestone:  1.4        |       Severity:  Normal
                Version:  SVN        |       Keywords:  mysql transaction
             Resolution:             |  isolation
           Triage Stage:  Accepted   |      Has patch:  1
    Needs documentation:  1          |    Needs tests:  0
Patch needs improvement:  1          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------

Comment (by akaariai):

 According to my quick test, this only works if you have done no queries at
 all before taking the savepoint. No matter which table you select from
 before the SAVEPOINT p1. So, this would be only a minor improvement:
 get_or_create works correctly, but only if it is the first operation in
 the transaction. You can see this if you put any select above the SNAPSHOT
 P1; for process 1.

 The reason seems to be that MySQL takes the snapshot only when first
 needed. But if it happens to take the snapshot inside savepoint, for some
 strange reason it rolls the snapshot back when rollback to savepoint is
 called, and creates a new snapshot for the second select. If anything,
 that is a bug in MySQL, because you just had a non-repeatable read in
 repeatable read isolation.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/13906#comment:30>
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 django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to