On May 12, 12:47 pm, Phil Mocek <pmocek-list-django-us...@mocek.org>
wrote:
> On Tue, May 12, 2009 at 02:25:41AM -0700, Daniel Roseman wrote:
> > No, [get_or_create is] not atomic. You can see the code in
> > django.db.models.query - it tries a db lookup, and then creates
&g
On Tue, 2009-05-12 at 10:47 -0700, Phil Mocek wrote:
> On Tue, May 12, 2009 at 02:25:41AM -0700, Daniel Roseman wrote:
> > No, [get_or_create is] not atomic.
By the way, that depends on what grained-ness of atomicity you're after,
which hasn't been defined in this thread. The
On 5/12/2009 10:47 AM, Phil Mocek wrote:
> It seems risky to try to handle at the
> application level these things that a DBMS is specifically
> designed to do.
Well, exactly. If the correct constraints are put in place, then your
DB/adaptor would raise the proper error.
So if a row is
On Tue, May 12, 2009 at 02:25:41AM -0700, Daniel Roseman wrote:
> No, [get_or_create is] not atomic. You can see the code in
> django.db.models.query - it tries a db lookup, and then creates
> a new object if one is not found.
It seems that this creates a potentially-troublesome race
On May 12, 10:04 am, Will McGugan wrote:
> Hi,
>
> I recently tracked down a strange bug in our site where 2 object existed but
> the code was expecting only one.
>
> I think this is due to get_or_create, which doesn't appear to be atomic.
> What I assume happened is that
Hi,
I recently tracked down a strange bug in our site where 2 object existed but
the code was expecting only one.
I think this is due to get_or_create, which doesn't appear to be atomic.
What I assume happened is that two requests came in close together and
tested for the existence of the object
et_or_create is an exception. And I'm guessing lots of
> other people already know this.
You're right. The get_or_create() call isn't atomic, because it isn't a
single database call and we cannot assume that the database layer has
transactions (because it's not universally true). The window of
opportunit
On 29/03/07, John Penix <[EMAIL PROTECTED]> wrote:
>
> I think I saw a get_or_create race condition today from concurrent
> runs of our data uploader that uses the model API. Ouch. The docs
> have several references to the api calls being atomic - now I'm
> thinking get_or_create is an
I think I saw a get_or_create race condition today from concurrent
runs of our data uploader that uses the model API. Ouch. The docs
have several references to the api calls being atomic - now I'm
thinking get_or_create is an exception. And I'm guessing lots of
other people already know this.
9 matches
Mail list logo