Commit 07ed5040 authored by Jim Fulton's avatar Jim Fulton

Bugs Fixed

- Objects added in transactions that were later aborted could have
  _p_changed still set (https://bugs.launchpad.net/zodb/+bug/615758).
parent 68a8fa51
...@@ -39,6 +39,9 @@ Bugs Fixed ...@@ -39,6 +39,9 @@ Bugs Fixed
The objects' _p_oid and _p_jar variables weren't cleared, leading to The objects' _p_oid and _p_jar variables weren't cleared, leading to
surprizing errors. surprizing errors.
- Objects added in transactions that were later aborted could have
_p_changed still set (https://bugs.launchpad.net/zodb/+bug/615758).
- ZEO extension methods failed when a client reconnected to a - ZEO extension methods failed when a client reconnected to a
storage. (https://bugs.launchpad.net/zodb/+bug/143344) storage. (https://bugs.launchpad.net/zodb/+bug/143344)
......
...@@ -448,6 +448,8 @@ class Connection(ExportImport, object): ...@@ -448,6 +448,8 @@ class Connection(ExportImport, object):
del self._cache[oid] del self._cache[oid]
del obj._p_jar del obj._p_jar
del obj._p_oid del obj._p_oid
if obj._p_changed:
obj._p_changed = False
else: else:
# Note: If we invalidate a non-ghostifiable object # Note: If we invalidate a non-ghostifiable object
...@@ -743,6 +745,8 @@ class Connection(ExportImport, object): ...@@ -743,6 +745,8 @@ class Connection(ExportImport, object):
self._invalidate_creating() self._invalidate_creating()
while self._added: while self._added:
oid, obj = self._added.popitem() oid, obj = self._added.popitem()
if obj._p_changed:
obj._p_changed = False
del obj._p_oid del obj._p_oid
del obj._p_jar del obj._p_jar
self._tpc_cleanup() self._tpc_cleanup()
...@@ -756,6 +760,8 @@ class Connection(ExportImport, object): ...@@ -756,6 +760,8 @@ class Connection(ExportImport, object):
o = self._cache.get(oid) o = self._cache.get(oid)
if o is not None: if o is not None:
del self._cache[oid] del self._cache[oid]
if o._p_changed:
o._p_changed = False
del o._p_jar del o._p_jar
del o._p_oid del o._p_oid
......
...@@ -632,6 +632,28 @@ def lp9460655(): ...@@ -632,6 +632,28 @@ def lp9460655():
""" """
def lp615758_transaction_abort_Incomplete_cleanup_for_new_objects():
r"""
As the following"DocTest" demonstrates, "abort" forgets to
reset "_p_changed" for new (i.e. "added") objects.
>>> class P(Persistent): pass
...
>>> c = ZODB.connection('t.fs')
>>> obj = P()
>>> c.add(obj)
>>> obj.x = 1
>>> obj._p_changed
True
>>> transaction.abort()
>>> obj._p_changed
False
>>> c.close()
"""
class _PlayPersistent(Persistent): class _PlayPersistent(Persistent):
def setValueWithSize(self, size=0): self.value = size*' ' def setValueWithSize(self, size=0): self.value = size*' '
__init__ = setValueWithSize __init__ = setValueWithSize
......
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