diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-03-23 16:54:03 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-03-23 16:54:03 -0400 |
commit | 0a29071b16e1844b5e1d71aead0e8a1ae83b48d0 (patch) | |
tree | 095de6b2f2b495163e9c52a2b90ba2a1a24c5b59 /doc/build/changelog/migration_11.rst | |
parent | 2d5b7a139f4d5e3cbf727c89a9b8389f4e12b26e (diff) | |
download | sqlalchemy-0a29071b16e1844b5e1d71aead0e8a1ae83b48d0.tar.gz |
- Further continuing on the common MySQL exception case of
a savepoint being cancelled first covered in :ticket:`2696`,
the failure mode in which the :class:`.Session` is placed when a
SAVEPOINT vanishes before rollback has been improved to allow the
:class:`.Session` to still function outside of that savepoint.
It is assumed that the savepoint operation failed and was cancelled.
fixes #3680
Diffstat (limited to 'doc/build/changelog/migration_11.rst')
-rw-r--r-- | doc/build/changelog/migration_11.rst | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/doc/build/changelog/migration_11.rst b/doc/build/changelog/migration_11.rst index 3e839af63..cca2b1ae8 100644 --- a/doc/build/changelog/migration_11.rst +++ b/doc/build/changelog/migration_11.rst @@ -16,7 +16,7 @@ What's New in SQLAlchemy 1.1? some issues may be moved to later milestones in order to allow for a timely release. - Document last updated: Feburary 25, 2016 + Document last updated: March 23, 2016 Introduction ============ @@ -290,6 +290,44 @@ time on the outside of the subquery. :ticket:`3582` +.. _change_3680: + +Improved Session state when a SAVEPOINT is cancelled by the database +-------------------------------------------------------------------- + +A common case with MySQL is that a SAVEPOINT is cancelled when a deadlock +occurs within the transaction. The :class:`.Session` has been modfied +to deal with this failure mode slightly more gracefully, such that the +outer, non-savepoint transaction still remains usable:: + + s = Session() + s.begin_nested() + + s.add(SomeObject()) + + try: + # assume the flush fails, flush goes to rollback to the + # savepoint and that also fails + s.flush() + except Exception as err: + print("Something broke, and our SAVEPOINT vanished too") + + # this is the SAVEPOINT transaction, marked as + # DEACTIVE so the rollback() call succeeds + s.rollback() + + # this is the outermost transaction, remains ACTIVE + # so rollback() or commit() can succeed + s.rollback() + +This issue is a continuation of :ticket:`2696` where we emit a warning +so that the original error can be seen when running on Python 2, even though +the SAVEPOINT exception takes precedence. On Python 3, exceptions are chained +so both failures are reported individually. + + +:ticket:`3680` + .. _change_3677: Erroneous "new instance X conflicts with persistent instance Y" flush errors fixed |