#18557: get_or_create() causes a race condition with MySQL
-------------------------------+--------------------------------------
Reporter: foxwhisper | Owner: nobody
Type: Uncategorized | Status: closed
Component: Core (URLs) | Version: 1.4
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by akaariai):
* status: new => closed
* needs_docs: => 0
* resolution: => wontfix
* needs_tests: => 0
* needs_better_patch: => 0
Comment:
You can't unconditionally do commit() in get_or_create. That breaks
transaction control. So, my opinion is that no chance to get into core as
is.
It seems this issue seems to raise its head from time to time. I haven't
hit this issue ever (maybe because I don't use get_or_create() that much,
and I don't use MySQL). I am interested to hear what kind of usage pattern
leads into concurrency problems in get_or_create()?
If the .commit() way of get_or_create is really wanted, then it needs to
be a separate method or at least a flag to get_or_create() is needed. I
won't object to such a patch, but neither will I pursue its commit.
I will mark this as wontfix - please reopen if you are going with the
flag/different method. The wontfix is specifically to the suggested
approach. Also, #13906 is related, though it is about the default
transaction isolation level.
--
Ticket URL: <https://code.djangoproject.com/ticket/18557#comment:1>
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.