Commit ce15095a authored by Christian Theune's avatar Christian Theune

Fixed bug 98275: Made ZEO cache more tolerant when invalidating current object

versions.
parent 85398aa0
...@@ -40,6 +40,9 @@ General ...@@ -40,6 +40,9 @@ General
ZEO ZEO
--- ---
- (3.9.0a1) Bug #98275: Made ZEO cache more tolerant when invalidating current
versions of objects.
- (3.9.0a1) Fixed a serious bug that could cause client I/O to stop - (3.9.0a1) Fixed a serious bug that could cause client I/O to stop
(hang). This was accomonied by a critical log message along the (hang). This was accomonied by a critical log message along the
lines of: "RuntimeError: dictionary changed size during iteration". lines of: "RuntimeError: dictionary changed size during iteration".
......
...@@ -364,7 +364,7 @@ class ClientCache(object): ...@@ -364,7 +364,7 @@ class ClientCache(object):
return return
# Add the data we have to the list of non-current data for oid. # Add the data we have to the list of non-current data for oid.
assert tid is not None and cur_tid < tid assert tid is not None and cur_tid <= tid
# 0x1C = invalidate (hit, saving non-current) # 0x1C = invalidate (hit, saving non-current)
self._trace(0x1C, oid, version, tid) self._trace(0x1C, oid, version, tid)
del self.current[oid] # because we no longer have current data del self.current[oid] # because we no longer have current data
......
...@@ -34,6 +34,8 @@ import ZODB.blob ...@@ -34,6 +34,8 @@ import ZODB.blob
import ZODB.tests.util import ZODB.tests.util
from ZODB.tests.MinPO import MinPO from ZODB.tests.MinPO import MinPO
from ZODB.tests.StorageTestBase import zodb_unpickle from ZODB.tests.StorageTestBase import zodb_unpickle
import persistent
import transaction
# ZODB test mixin classes # ZODB test mixin classes
from ZODB.tests import StorageTestBase, BasicStorage, VersionStorage, \ from ZODB.tests import StorageTestBase, BasicStorage, VersionStorage, \
...@@ -67,9 +69,34 @@ class OneTimeTests(unittest.TestCase): ...@@ -67,9 +69,34 @@ class OneTimeTests(unittest.TestCase):
# be identical. # be identical.
self.assertEqual(ZODB.__version__, ZEO.version) self.assertEqual(ZODB.__version__, ZEO.version)
class CreativeGetState(persistent.Persistent):
def __getstate__(self):
self.name = 'me'
return super(CreativeGetState, self).__getstate__()
class MiscZEOTests: class MiscZEOTests:
"""ZEO tests that don't fit in elsewhere.""" """ZEO tests that don't fit in elsewhere."""
def checkCreativeGetState(self):
# This test covers persistent objects that provide their own
# __getstate__ which modifies the state of the object.
# For details see bug #98275
db = ZODB.DB(self._storage)
cn = db.open()
rt = cn.root()
m = CreativeGetState()
m.attr = 'hi'
rt['a'] = m
# This commit used to fail because of the `Mine` object being put back
# into `changed` state although it was already stored causing the ZEO
# cache to bail out.
transaction.commit()
cn.close()
def checkLargeUpdate(self): def checkLargeUpdate(self):
obj = MinPO("X" * (10 * 128 * 1024)) obj = MinPO("X" * (10 * 128 * 1024))
self._dostore(data=obj) self._dostore(data=obj)
......
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