[Zodb-checkins] CVS: ZODB3/ZEO/tests - InvalidationTests.py:1.6.2.3
test_cache.py:1.1.2.9
Jeremy Hylton
cvs-admin at zope.org
Tue Dec 2 02:11:01 EST 2003
Update of /cvs-repository/ZODB3/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv24432/ZEO/tests
Modified Files:
Tag: ZODB3-mvcc-2-branch
InvalidationTests.py test_cache.py
Log Message:
First cut at removal of serial numbers.
Rename loadNonCurrent() to loadBefore() (Jim's suggestion).
A few tests fail, but it's close enough to share the code with Tim.
In all case, the _p_serial attribute of a Persistent object matches
the id of the transaction that wrote the current revision. Within the
storage API, we eliminate the abortVersion case where the txn id is
greater than the serial number.
Rename as many variables and attributes from serial to tid, with the
exception of store() and restore() arguments. They're being passed in
from a client, which is getting the value from _p_serial; it makes
some sense there.
When tid and serial were both returned, eliminate serial and just use
tid.
Replace "serial" with "tid" in some methods names, but not all. I'll
get to the rest tomorrow. The remaining ones are just used a lot.
Add XXX comment about now-bogus ZEO protocol that passes identical
serialnos for every object committed.
=== ZODB3/ZEO/tests/InvalidationTests.py 1.6.2.2 => 1.6.2.3 ===
--- ZODB3/ZEO/tests/InvalidationTests.py:1.6.2.2 Mon Dec 1 10:16:09 2003
+++ ZODB3/ZEO/tests/InvalidationTests.py Tue Dec 2 02:10:30 2003
@@ -443,6 +443,7 @@
t1 = VersionStressThread(self, db1, stop, 1, cd, 1, 3)
t2 = VersionStressThread(self, db2, stop, 2, cd, 2, 3, 0.01)
t3 = VersionStressThread(self, db2, stop, 3, cd, 3, 3, 0.01)
+## t1 = VersionStressThread(self, db2, stop, 3, cd, 1, 3, 0.01)
self.go(stop, cd, t1, t2, t3)
cn.sync()
=== ZODB3/ZEO/tests/test_cache.py 1.1.2.8 => 1.1.2.9 ===
--- ZODB3/ZEO/tests/test_cache.py:1.1.2.8 Mon Dec 1 10:16:09 2003
+++ ZODB3/ZEO/tests/test_cache.py Tue Dec 2 02:10:30 2003
@@ -49,8 +49,8 @@
data1 = "data for n1"
self.assertEqual(self.cache.load(n1, ""), None)
self.assertEqual(self.cache.load(n1, "version"), None)
- self.cache.store(n1, "", n2, n3, None, data1)
- self.assertEqual(self.cache.load(n1, ""), (data1, n2, n3, ""))
+ self.cache.store(n1, "", n3, None, data1)
+ self.assertEqual(self.cache.load(n1, ""), (data1, n3, ""))
# The cache doesn't know whether version exists, because it
# only has non-version data.
self.assertEqual(self.cache.load(n1, "version"), None)
@@ -58,20 +58,20 @@
def testInvalidate(self):
data1 = "data for n1"
- self.cache.store(n1, "", n2, n3, None, data1)
+ self.cache.store(n1, "", n3, None, data1)
self.cache.invalidate(n1, "", n4)
self.cache.invalidate(n2, "", n2)
self.assertEqual(self.cache.load(n1, ""), None)
- self.assertEqual(self.cache.loadNonCurrent(n1, n4),
- (data1, n2, n3, n4))
+ self.assertEqual(self.cache.loadBefore(n1, n4),
+ (data1, n3, n4))
def testVersion(self):
data1 = "data for n1"
data1v = "data for n1 in version"
- self.cache.store(n1, "version", n2, n3, None, data1v)
+ self.cache.store(n1, "version", n3, None, data1v)
self.assertEqual(self.cache.load(n1, ""), None)
self.assertEqual(self.cache.load(n1, "version"),
- (data1v, n2, n3, "version"))
+ (data1v, n3, "version"))
self.assertEqual(self.cache.load(n1, "random"), None)
self.assertEqual(self.cache.modifiedInVersion(n1), "version")
self.cache.invalidate(n1, "version", n4)
@@ -80,28 +80,26 @@
def testNonCurrent(self):
data1 = "data for n1"
data2 = "data for n2"
- self.cache.store(n1, "", n4, n4, None, data1)
- self.cache.store(n1, "", n2, n2, n3, data2)
+ self.cache.store(n1, "", n4, None, data1)
+ self.cache.store(n1, "", n2, n3, data2)
# can't say anything about state before n2
- self.assertEqual(self.cache.loadNonCurrent(n1, n2), None)
+ self.assertEqual(self.cache.loadBefore(n1, n2), None)
# n3 is the upper bound of non-current record n2
- self.assertEqual(self.cache.loadNonCurrent(n1, n3),
- (data2, n2, n2, n3))
+ self.assertEqual(self.cache.loadBefore(n1, n3), (data2, n2, n3))
# no data for between n2 and n3
- self.assertEqual(self.cache.loadNonCurrent(n1, n4), None)
+ self.assertEqual(self.cache.loadBefore(n1, n4), None)
self.cache.invalidate(n1, "", n5)
- self.assertEqual(self.cache.loadNonCurrent(n1, n5),
- (data1, n4, n4, n5))
- self.assertEqual(self.cache.loadNonCurrent(n2, n4), None)
+ self.assertEqual(self.cache.loadBefore(n1, n5), (data1, n4, n5))
+ self.assertEqual(self.cache.loadBefore(n2, n4), None)
def testException(self):
self.assertRaises(ValueError,
self.cache.store,
- n1, "version", n2, n2, n3, "data")
- self.cache.store(n1, "", n2, n2, None, "data")
+ n1, "version", n2, n3, "data")
+ self.cache.store(n1, "", n2, None, "data")
self.assertRaises(ValueError,
self.cache.store,
- n1, "", n3, n3, None, "data")
+ n1, "", n3, None, "data")
def testEviction(self):
# Manually override the current maxsize
@@ -112,13 +110,13 @@
data = ["z" * i for i in range(100)]
for i in range(50):
n = p64(i)
- self.cache.store(n, "", n, n, None, data[i])
+ self.cache.store(n, "", n, None, data[i])
self.assertEquals(len(self.cache), i + 1)
self.assert_(self.cache.dll.currentsize < maxsize)
# The cache now uses 1225 bytes. The next insert
# should delete some objects.
n = p64(50)
- self.cache.store(n, "", n, n, None, data[51])
+ self.cache.store(n, "", n, None, data[51])
self.assert_(len(self.cache) < 51)
self.assert_(self.cache.dll.currentsize <= maxsize)
@@ -126,10 +124,10 @@
# and of version data are handled correctly.
def testSerialization(self):
- self.cache.store(n1, "", n2, n2, None, "data for n1")
- self.cache.store(n2, "version", n2, n2, None, "version data for n2")
- self.cache.store(n3, "", n3, n3, n4, "non-current data for n3")
- self.cache.store(n3, "", n4, n4, n5, "more non-current data for n3")
+ self.cache.store(n1, "", n2, None, "data for n1")
+ self.cache.store(n2, "version", n2, None, "version data for n2")
+ self.cache.store(n3, "", n3, n4, "non-current data for n3")
+ self.cache.store(n3, "", n4, n5, "more non-current data for n3")
self.cache.path = tempfile.mktemp()
self.cache._write()
More information about the Zodb-checkins
mailing list