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

Barry Warsaw barry@wooz.org
Mon, 27 Jan 2003 16:09:34 -0500


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

Modified Files:
	BDBFullStorage.py 
Log Message:
_version_check(): Backport the setting up and checking of the storage
version string.


=== ZODB3/BDBStorage/BDBFullStorage.py 1.66 => 1.67 ===
--- ZODB3/BDBStorage/BDBFullStorage.py:1.66	Tue Jan 21 14:25:59 2003
+++ ZODB3/BDBStorage/BDBFullStorage.py	Mon Jan 27 16:09:31 2003
@@ -53,6 +53,8 @@
     True = 1
     False = 0
 
+BDBFULL_SCHEMA_VERSION = 'BF01'
+
 
 
 class BDBFullStorage(BerkeleyBase, ConflictResolvingStorage):
@@ -185,7 +187,10 @@
         #         packtime - time of the last pack.  It is illegal to undo to
         #         before the last pack time.
         #
-        #         version - the version of the database (reserved for ZODB4)
+        #         dbversion - the version of the database serialization
+        #         protocol (reserved for ZODB4)
+        #
+        #         version - the underlying Berkeley database schema version
         #
         # objrevs -- {newserial+oid -> oldserial}
         #     This table collects object revision information for packing
@@ -234,6 +239,13 @@
         self._delqueue = self._setupDB('delqueue', 0, db.DB_QUEUE, 8)
         # Do recovery and consistency checks
         self._withlock(self._dorecovery)
+
+    def _version_check(self, txn):
+        version = self._info.get('version')
+        if version is None:
+            self._info.put('version', BDBFULL_SCHEMA_VERSION, txn=txn)
+        elif version <> BDBFULL_SCHEMA_VERSION:
+            raise StorageSystemError, 'incompatible storage version'
 
     def _make_autopacker(self, event):
         config = self._config