[prev in list] [next in list] [prev in thread] [next in thread]
List: zope-cvs
Subject: [Zope-Checkins] CVS: Packages/ZODB/tests -
From: Tim Peters <tim.one () comcast ! net>
Date: 2005-02-28 21:20:42
Message-ID: 20050228212042.4BC4F203252 () mail ! zope ! org
[Download RAW message or body]
Update of /cvs-repository/Packages/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv8391/ZODB/tests
Modified Files:
Tag: Zope-2_7-branch
testFileStorage.py
Log Message:
Change FileStorage .restore() and .store() to update max oid in use.
This is the last of the checkins to fix critical bugs involving rare cases
where a FileStorage could end up reusing old oids for new objects.
=== Packages/ZODB/tests/testFileStorage.py 1.32.8.6 => 1.32.8.7 ===
--- Packages/ZODB/tests/testFileStorage.py:1.32.8.6 Fri Feb 25 15:31:04 2005
+++ Packages/ZODB/tests/testFileStorage.py Mon Feb 28 16:20:41 2005
@@ -279,6 +279,39 @@
db.close()
StorageTestBase.removefs("FileStorageTests.fs")
+ def checkStoreBumpsOid(self):
+ # If .store() is handed an oid bigger than the storage knows
+ # about already, it's crucial that the storage bump its notion
+ # of the largest oid in use.
+ t = Transaction()
+ self._storage.tpc_begin(t)
+ giant_oid = '\xee' * 8
+ # Store an object.
+ # oid, serial, data, version, transaction
+ r1 = self._storage.store(giant_oid, '\0'*8, 'data', '', t)
+ # Finish the transaction.
+ r2 = self._storage.tpc_vote(t)
+ self._storage.tpc_finish(t)
+ # Before ZODB 3.2.6, this failed, with ._oid == z64.
+ self.assertEqual(self._storage._oid, giant_oid)
+
+ def checkRestoreBumpsOid(self):
+ # As above, if .restore() is handed an oid bigger than the storage
+ # knows about already, it's crucial that the storage bump its notion
+ # of the largest oid in use. Because copyTransactionsFrom(), and
+ # ZRS recovery, use the .restore() method, this is plain critical.
+ t = Transaction()
+ self._storage.tpc_begin(t)
+ giant_oid = '\xee' * 8
+ # Store an object.
+ # oid, serial, data, version, prev_txn, transaction
+ r1 = self._storage.restore(giant_oid, '\0'*8, 'data', '', None, t)
+ # Finish the transaction.
+ r2 = self._storage.tpc_vote(t)
+ self._storage.tpc_finish(t)
+ # Before ZODB 3.2.6, this failed, with ._oid == z64.
+ self.assertEqual(self._storage._oid, giant_oid)
+
def checkCorruptionInPack(self):
# This sets up a corrupt .fs file, with a redundant transaction
# length mismatch. The implementation of pack in many releases of
_______________________________________________
Zope-Checkins maillist - Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic