[Zope3-checkins] CVS: ZODB4/src/zodb/storage - bdbminimal.py:1.8

Barry Warsaw barry@wooz.org
Fri, 24 Jan 2003 13:54:53 -0500


Update of /cvs-repository/ZODB4/src/zodb/storage
In directory cvs.zope.org:/tmp/cvs-serv7881

Modified Files:
	bdbminimal.py 
Log Message:
_version_check(): Add a storage-level version string to the info
table.  When opening the database, assert that it's either missing (in
which case, we add it), or it matches the known current value.  Since
there's no previous version, raise a StorageSystemError if they
differ.


=== ZODB4/src/zodb/storage/bdbminimal.py 1.7 => 1.8 ===
--- ZODB4/src/zodb/storage/bdbminimal.py:1.7	Thu Jan 23 15:38:57 2003
+++ ZODB4/src/zodb/storage/bdbminimal.py	Fri Jan 24 13:54:50 2003
@@ -27,6 +27,8 @@
 COMMIT = 'C'
 PRESENT = 'X'
 
+BDBMINIMAL_SCHEMA_VERSION = 'BM01'
+
 
 
 def DB(name, config):
@@ -97,7 +99,16 @@
         #     It is also used during pack to list objects for which no more
         #     references exist, such that the objects can be completely packed
         #     away.
-        #
+        pass
+
+    def _version_check(self, txn):
+        version = self._info.get('version')
+        if version is None:
+            self._info.put('version', BDBMINIMAL_SCHEMA_VERSION, txn=txn)
+        elif version <> BDBMINIMAL_SCHEMA_VERSION:
+            raise StorageSystemError, 'incompatible storage version'
+
+    def _dorecovery(self):
         # Do recovery and consistency checks
         pendings = self._pending.keys()
         assert len(pendings) <= 1