[Zodb-checkins] SVN: ZODB/trunk/src/ Fixed a serious bug that caused cache failures when run
Jim Fulton
jim at zope.com
Wed Apr 21 16:55:25 EDT 2010
Log message for revision 111229:
Fixed a serious bug that caused cache failures when run
with Python optimization turned on.
https://bugs.launchpad.net/zodb/+bug/544305
Changed:
U ZODB/trunk/src/CHANGES.txt
U ZODB/trunk/src/ZEO/cache.py
-=-
Modified: ZODB/trunk/src/CHANGES.txt
===================================================================
--- ZODB/trunk/src/CHANGES.txt 2010-04-21 19:32:30 UTC (rev 111228)
+++ ZODB/trunk/src/CHANGES.txt 2010-04-21 20:55:25 UTC (rev 111229)
@@ -20,6 +20,11 @@
Bugs Fixed
----------
+- 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)
Modified: ZODB/trunk/src/ZEO/cache.py
===================================================================
--- ZODB/trunk/src/ZEO/cache.py 2010-04-21 19:32:30 UTC (rev 111228)
+++ ZODB/trunk/src/ZEO/cache.py 2010-04-21 20:55:25 UTC (rev 111229)
@@ -473,7 +473,8 @@
return None
self.f.seek(ofs)
read = self.f.read
- assert read(1) == 'a', (ofs, self.f.tell(), oid)
+ status = read(1)
+ assert status == 'a', (ofs, self.f.tell(), oid)
size, saved_oid, tid, end_tid, lver, ldata = unpack(
">I8s8s8sHI", read(34))
assert saved_oid == oid, (ofs, self.f.tell(), oid, saved_oid)
@@ -481,6 +482,9 @@
data = read(ldata)
assert len(data) == ldata, (ofs, self.f.tell(), oid, len(data), ldata)
+
+ # WARNING: The following assert changes the file position.
+ # We must not depend on this below or we'll fail in optimized mode.
assert read(8) == oid, (ofs, self.f.tell(), oid)
self._n_accesses += 1
@@ -509,7 +513,8 @@
self.f.seek(ofs)
read = self.f.read
- assert read(1) == 'a', (ofs, self.f.tell(), oid, before_tid)
+ status = read(1)
+ assert status == 'a', (ofs, self.f.tell(), oid, before_tid)
size, saved_oid, saved_tid, end_tid, lver, ldata = unpack(
">I8s8s8sHI", read(34))
assert saved_oid == oid, (ofs, self.f.tell(), oid, saved_oid)
@@ -518,6 +523,9 @@
assert lver == 0, "Versions aren't supported"
data = read(ldata)
assert len(data) == ldata, (ofs, self.f.tell())
+
+ # WARNING: The following assert changes the file position.
+ # We must not depend on this below or we'll fail in optimized mode.
assert read(8) == oid, (ofs, self.f.tell(), oid)
if end_tid < before_tid:
@@ -545,7 +553,8 @@
if ofs:
seek(ofs)
read = self.f.read
- assert read(1) == 'a', (ofs, self.f.tell(), oid)
+ status = read(1)
+ assert status == 'a', (ofs, self.f.tell(), oid)
size, saved_oid, saved_tid, end_tid = unpack(
">I8s8s8s", read(28))
assert saved_oid == oid, (ofs, self.f.tell(), oid, saved_oid)
@@ -657,7 +666,8 @@
self.f.seek(ofs)
read = self.f.read
- assert read(1) == 'a', (ofs, self.f.tell(), oid)
+ status = read(1)
+ assert status == 'a', (ofs, self.f.tell(), oid)
size, saved_oid, saved_tid, end_tid = unpack(">I8s8s8s", read(28))
assert saved_oid == oid, (ofs, self.f.tell(), oid, saved_oid)
assert end_tid == z64, (ofs, self.f.tell(), oid)
@@ -687,7 +697,8 @@
self._lock.acquire()
try:
seek(ofs)
- assert read(1) == 'a', (ofs, self.f.tell(), oid)
+ status = read(1)
+ assert status == 'a', (ofs, self.f.tell(), oid)
size, saved_oid, tid, end_tid = unpack(">I8s8s8s", read(28))
assert saved_oid == oid, (ofs, self.f.tell(), oid, saved_oid)
assert end_tid == z64, (ofs, self.f.tell(), oid)
More information about the Zodb-checkins
mailing list