#22802: update Atomic class to make use of public transaction module-level API
functions
-------------------------------------+-------------------------------------
Reporter: gwilson | Owner: gwilson
Type: | Status: closed
Cleanup/optimization | Version: 1.6
Component: Database layer | Resolution: wontfix
(models, ORM) | Triage Stage:
Severity: Normal | Unreviewed
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 1
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by aaugustin):
* status: assigned => closed
* resolution: => wontfix
Comment:
I checked the previous implementation. Indeed the old transaction
decorators / context managers relied the module level functions. That was
consistent because they were stateless (which was technically a bug).
The new atomic decorator / context manager is stateful. It stores its
state on the connection object because, if several atomics are nested,
they don't know about one another, they just share a connection. So the
new implementation switched to using the connection everywhere for
consistency.
I acknowledged that the DatabaseWrapper API is a bit scary, but
transactions-related methods are well docstring'd. I don't belive they're
much more difficult to patch than `django.db.transactions`. One just needs
to inspect `settings.DATABASES['...']['ENGINE']` to determine which
classes need patching.
In addition, monkey-patching should really happen at that level. The docs
say that [https://docs.djangoproject.com/en/dev/topics/db/sql
/#connections-and-cursors connections and cursors] do not follow PEP 249
for transaction handling, but `connection.commit()` or
`connection.rollback()` work as expected and there's certainly some code
that relies on this.
Considering how bad corruption at that level could get, I'm -1 on making
changes to allow the johnny-cache authors to implement an unsafe solution.
--
Ticket URL: <https://code.djangoproject.com/ticket/22802#comment:9>
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/065.f5aa6e198d23d90891e417922340ee87%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.