Commit b4ad9d5a authored by Jim Fulton's avatar Jim Fulton

Merge remote-tracking branch 'origin/master' into transactions-and-threading

Conflicts:
	CHANGES.rst
parents f5bf3ed7 09010439
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Change History Change History
================ ================
5.0.1 (2016-09-09) 5.0.1 (unreleased)
================== ==================
- Fix an AttributeError that DemoStorage could raise if it was asked - Fix an AttributeError that DemoStorage could raise if it was asked
...@@ -12,6 +12,11 @@ ...@@ -12,6 +12,11 @@
- Call _p_resolveConflict() even if a conflicting change doesn't change the - Call _p_resolveConflict() even if a conflicting change doesn't change the
state. This reverts to the behaviour of 3.10.3 and older. state. This reverts to the behaviour of 3.10.3 and older.
- Closing a Connection now reverts its ``transaction_manager`` to
None. This helps prevent errors and release resources when the
``transaction_manager`` was the (default) thread-local manager. See
`issue 114 <https://github.com/zopefoundation/ZODB/issues/114>`_.
- Many docstrings have been improved. - Many docstrings have been improved.
5.0.0 (2016-09-06) 5.0.0 (2016-09-06)
......
...@@ -8,7 +8,7 @@ Storage interfaces ...@@ -8,7 +8,7 @@ Storage interfaces
================== ==================
There are various storage implementations that implement standard There are various storage implementations that implement standard
storage interfaces. Thet differ primarily in their constructors. storage interfaces. They differ primarily in their constructors.
Application code rarely calls storage methods, and those it calls are Application code rarely calls storage methods, and those it calls are
generally called indirectly through databases. There are generally called indirectly through databases. There are
...@@ -144,7 +144,7 @@ Options: ...@@ -144,7 +144,7 @@ Options:
Noteworthy non-included storages Noteworthy non-included storages
================================ ================================
A number of important ZODB storages are distriubuted separately, including: A number of important ZODB storages are distributed separately, including:
RelStorage RelStorage
`RelStorage <http://relstorage.readthedocs.io/en/latest/>`_ `RelStorage <http://relstorage.readthedocs.io/en/latest/>`_
...@@ -153,7 +153,7 @@ RelStorage ...@@ -153,7 +153,7 @@ RelStorage
storing data in relational databases. Unlike the included storages, storing data in relational databases. Unlike the included storages,
multiple processes can share the same database. multiple processes can share the same database.
For more imformation, see http://relstorage.readthedocs.io/en/latest/. For more information, see http://relstorage.readthedocs.io/en/latest/.
ZEO ZEO
`ZEO <https://github.com/zopefoundation/ZEO>`_ is a client-server `ZEO <https://github.com/zopefoundation/ZEO>`_ is a client-server
...@@ -161,7 +161,7 @@ ZEO ...@@ -161,7 +161,7 @@ ZEO
and use ZEO clients in your application. Unlike the included and use ZEO clients in your application. Unlike the included
storages, multiple processes can share the same database. storages, multiple processes can share the same database.
For more imformation, see https://github.com/zopefoundation/ZEO. For more information, see https://github.com/zopefoundation/ZEO.
ZRS ZRS
`ZRS <https://github.com/zc/zrs>`_ `ZRS <https://github.com/zc/zrs>`_
...@@ -173,14 +173,14 @@ ZRS ...@@ -173,14 +173,14 @@ ZRS
committed on the primary, they're copied asynchronously to committed on the primary, they're copied asynchronously to
secondaries. secondaries.
For more imformation, see https://github.com/zc/zrs. For more information, see https://github.com/zc/zrs.
zlibstorage zlibstorage
`zlibstorage <https://pypi.python.org/pypi/zc.zlibstorage>`_ `zlibstorage <https://pypi.python.org/pypi/zc.zlibstorage>`_
compresses database records using the compression compresses database records using the compression
algorithm used by `gzip <http://www.gzip.org/>`_. algorithm used by `gzip <http://www.gzip.org/>`_.
For more imformation, see https://pypi.python.org/pypi/zc.zlibstorage. For more information, see https://pypi.python.org/pypi/zc.zlibstorage.
beforestorage beforestorage
`beforestorage <https://pypi.python.org/pypi/zc.beforestorage>`_ `beforestorage <https://pypi.python.org/pypi/zc.beforestorage>`_
...@@ -188,12 +188,12 @@ beforestorage ...@@ -188,12 +188,12 @@ beforestorage
be changing. This can be useful to provide a non-changing view of a be changing. This can be useful to provide a non-changing view of a
production database for use with a :class:`~ZODB.DemoStorage.DemoStorage`. production database for use with a :class:`~ZODB.DemoStorage.DemoStorage`.
For more imformation, see https://pypi.python.org/pypi/zc.beforestorage. For more information, see https://pypi.python.org/pypi/zc.beforestorage.
cipher.encryptingstorage cipher.encryptingstorage
`cipher.encryptingstorage `cipher.encryptingstorage
<https://pypi.python.org/pypi/cipher.encryptingstorage/>`_ provided <https://pypi.python.org/pypi/cipher.encryptingstorage/>`_ provided
compression and encryption of database records. compression and encryption of database records.
For more informayion see, For more information, see
https://pypi.python.org/pypi/cipher.encryptingstorage/. https://pypi.python.org/pypi/cipher.encryptingstorage/.
...@@ -295,7 +295,9 @@ class Connection(ExportImport, object): ...@@ -295,7 +295,9 @@ class Connection(ExportImport, object):
self._debug_info = () self._debug_info = ()
if self.opened: if self.opened and self.transaction_manager is not None:
# transaction_manager could be None if one of the __onCloseCallbacks
# closed the DB already, .e.g, ZODB.connection() does this.
self.transaction_manager.unregisterSynch(self) self.transaction_manager.unregisterSynch(self)
if primary: if primary:
...@@ -318,6 +320,9 @@ class Connection(ExportImport, object): ...@@ -318,6 +320,9 @@ class Connection(ExportImport, object):
if am is not None: if am is not None:
am.closedConnection(self) am.closedConnection(self)
# Drop transaction manager to release resources and help prevent errors
self.transaction_manager = None
def db(self): def db(self):
"""Returns a handle to the database this connection belongs to.""" """Returns a handle to the database this connection belongs to."""
return self._db return self._db
...@@ -911,6 +916,7 @@ class Connection(ExportImport, object): ...@@ -911,6 +916,7 @@ class Connection(ExportImport, object):
c._storage.release() c._storage.release()
c._storage = c._normal_storage = None c._storage = c._normal_storage = None
c._cache = PickleCache(self, 0, 0) c._cache = PickleCache(self, 0, 0)
c.transaction_manager = None
########################################################################## ##########################################################################
# Python protocol # Python protocol
......
...@@ -637,6 +637,7 @@ class DB(object): ...@@ -637,6 +637,7 @@ class DB(object):
@self._connectionMap @self._connectionMap
def _(c): def _(c):
if c.transaction_manager is not None:
c.transaction_manager.abort() c.transaction_manager.abort()
c.afterCompletion = c.newTransaction = c.close = noop c.afterCompletion = c.newTransaction = c.close = noop
c._release_resources() c._release_resources()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment