[Zodb-checkins] CVS: ZODB3/BDBStorage - BDBFullStorage.py:1.75.2.3

Jeremy Hylton cvs-admin at zope.org
Sun Nov 23 16:39:24 EST 2003


Update of /cvs-repository/ZODB3/BDBStorage
In directory cvs.zope.org:/tmp/cvs-serv5060

Modified Files:
      Tag: ZODB3-mvcc-2-branch
	BDBFullStorage.py 
Log Message:
Revise loadEx() behavior and raise ReadOnlyError in some places.

The loadEx() change doesn't seem to make any difference for the tests,
which is worrisome.  Return the serial and tid from the current txn
instead of from the txn that wrote the non-version data.  This matches
FileStorage behavior and is needed for compatibility with the ZEO
cache.



=== ZODB3/BDBStorage/BDBFullStorage.py 1.75.2.2 => 1.75.2.3 ===
--- ZODB3/BDBStorage/BDBFullStorage.py:1.75.2.2	Tue Nov 18 14:08:51 2003
+++ ZODB3/BDBStorage/BDBFullStorage.py	Sun Nov 23 16:39:23 2003
@@ -756,6 +756,8 @@
     def abortVersion(self, version, transaction):
         # Abort the version, but retain enough information to make the abort
         # undoable.
+        if self._is_read_only:
+            raise POSException.ReadOnlyError()
         if transaction is not self._transaction:
             raise POSException.StorageTransactionError(self, transaction)
         # We can't abort the empty version, because it's not a version!
@@ -831,6 +833,8 @@
         # perfectly valid to move an object from one version to another.  src
         # and dest are version strings, and if we're committing to a
         # non-version, dest will be empty.
+        if self._is_read_only:
+            raise POSException.ReadOnlyError()
         if transaction is not self._transaction:
             raise POSException.StorageTransactionError(self, transaction)
         # Sanity checks
@@ -927,14 +931,12 @@
             # object is living in is the one that was requested, we simply
             # return the current revision's pickle.
             if vid == ZERO or self._versions.get(vid) == version:
-                return self._pickles[oid+lrevid], serial, tid
+                return self._pickles[oid+lrevid], serial, tid, version
             # The object was living in a version, but not the one requested.
             # Semantics here are to return the non-version revision.  Allow
             # KeyErrors to percolate up (meaning there's no non-version rev).
             lrevid = self._metadata[oid+nvrevid][16:24]
-            # XXX Is nrevid always correct?  That is, will the tid always
-            # match the serialno for non-vrsion data?
-            return self._pickles[oid+lrevid], nvrevid, nvrevid
+            return self._pickles[oid+lrevid], serial, tid, ""
         finally:
             self._lock_release()
 
@@ -1200,6 +1202,8 @@
         return self._serial, rtnoids.keys()
 
     def transactionalUndo(self, tid, transaction):
+        if self._is_read_only:
+            raise POSException.ReadOnlyError()
         if transaction is not self._transaction:
             raise POSException.StorageTransactionError(self, transaction)
         self._lock_acquire()




More information about the Zodb-checkins mailing list