Commit 18e3890c authored by Jim Fulton's avatar Jim Fulton

Fixed a bug that caused savepoint rollback to not properly

set object state when objects implemented _p_invalidate methods
that reloaded ther state (unghostifiable objects).

https://bugs.launchpad.net/zodb/+bug/428039
parent 4e371f75
......@@ -26,13 +26,19 @@ New Features
Bugs Fixed
----------
- Fixed bug in cPickleCache's byte size estimation logic.
(https://bugs.launchpad.net/zodb/+bug/533015)
- Fixed a serious bug that caused cache failures when run
with Python optimization turned on.
https://bugs.launchpad.net/zodb/+bug/544305
- Fixed bug in cPickleCache's byte size estimation logic.
(https://bugs.launchpad.net/zodb/+bug/533015)
- Fixed a bug that caused savepoint rollback to not properly
set object state when objects implemented _p_invalidate methods
that reloaded ther state (unghostifiable objects).
https://bugs.launchpad.net/zodb/+bug/428039
- When using using a ClientStorage in a Storage server, there was a
threading bug that caused clients to get disconnected.
......
......@@ -1119,8 +1119,9 @@ class Connection(ExportImport, object):
self._abort()
self._registered_objects = []
src = self._storage
self._cache.invalidate(src.index)
index = src.index
src.reset(*state)
self._cache.invalidate(index)
def _commit_savepoint(self, transaction):
"""Commit all changes made in savepoints and begin 2-phase commit
......
......@@ -154,6 +154,34 @@ We simply rely on the underlying storage method.
False
"""
class SelfActivatingObject(persistent.Persistent):
def _p_invalidate(self):
super(SelfActivatingObject, self)._p_invalidate()
self._p_activate()
def testInvalidateAfterRollback():
"""\
The rollback used to invalidate objects before resetting the TmpStore.
This caused problems for custom _p_invalidate methods that would load
the wrong state.
>>> import ZODB.tests.util
>>> db = ZODB.tests.util.DB()
>>> connection = db.open()
>>> root = connection.root()
>>> root['p'] = p = SelfActivatingObject()
>>> transaction.commit()
>>> p.foo = 1
>>> sp = transaction.savepoint()
>>> p.foo = 2
>>> sp2 = transaction.savepoint()
>>> sp.rollback()
>>> p.foo # This used to wrongly return 2
1
"""
def tearDown(test):
transaction.abort()
......
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