By reading the doc: https://docs.djangoproject.com/en/dev/topics/db/transactions/#django.db.transaction.atomic
I know that
atomic blocks can be nested. In this case, when an inner block completes successfully, its effects can still be rolled back if an exception is raised in the outer block at a later point.
However, my question is that for a code structure like following:
@transaction.atomic
def A():
## something
B()
C()
## something
@transaction.atomic
def B():
## something
@transaction.atomic
def C():
## something
If B and C both succeed, and A goes wrong after them, then B and C will right back, right?
What if B succeed, but C messed up, will B get roll back?
And about the memory usage for maintaining this roll back functionality, is there any difference between the one above and the one following:
@transaction.atomic
def A():
B()
C()
def B():
## something
def C():
## something
I know these two structure handle different case. I am just asking, assume they both succeed (completely), what is the difference at the memory usage level?
Thanks in advance.