#20571: Using savepoints within transaction.atomic() can result in the entire
transaction being incorrectly and silently rolled back
-------------------------------------+-------------------------------------
     Reporter:  lamby                |                    Owner:  aaugustin
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:
  (models, ORM)                      |  1.6-alpha-1
     Severity:  Release blocker      |               Resolution:  fixed
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by akaariai):

 I think Django should prevent running *anything else* than rollback or
 savepoint rollback once inside a transaction that is marked as
 needs_rollback. This is what PostgreSQL does, and with good reason -
 letting users continue a transaction that will be rolled back anyways will
 lead to errors. Addition of needs_rollback API lets users continue after
 errors when needed, but do so only explicitly.

 BTW I think I proposed adding @in_transaction decorator, not
 atomic(savepoint=False). This would have been no-op if a transaction was
 going on, otherwise it would have created a transaction. This is subtly
 different from @atomic(savepoint=False) which marks the outer block for
 needs_rollback on errors. @in_transaction is what is needed by
 model.save() for example (and yes, using savepoints unconditionally in
 that case is too expensive).

 In any case, this ticket is already solved so time to move on.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20571#comment:13>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.34c69cde72b518d138699b15a1b8aa33%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to