[Zodb-checkins] SVN: ZODB/branches/jim-zeo-blob-cache/src/Z checkpoint

Jim Fulton jim at zope.com
Tue Dec 2 19:02:28 EST 2008


Log message for revision 93563:
  checkpoint

Changed:
  U   ZODB/branches/jim-zeo-blob-cache/src/ZEO/ClientStorage.py
  U   ZODB/branches/jim-zeo-blob-cache/src/ZEO/tests/testZEO.py
  U   ZODB/branches/jim-zeo-blob-cache/src/ZODB/blob.py

-=-
Modified: ZODB/branches/jim-zeo-blob-cache/src/ZEO/ClientStorage.py
===================================================================
--- ZODB/branches/jim-zeo-blob-cache/src/ZEO/ClientStorage.py	2008-12-02 23:21:49 UTC (rev 93562)
+++ ZODB/branches/jim-zeo-blob-cache/src/ZEO/ClientStorage.py	2008-12-03 00:02:27 UTC (rev 93563)
@@ -1015,16 +1015,25 @@
                                            "configured.")
 
         blob_filename = self.fshelper.getBlobFilename(oid, serial)
-        # Case 1: Blob is available already, just use it
+        if self.shared_blob_dir:
+            if os.path.exists(blob_filename):
+                return blob_filename
+            else:
+                # We're using a server shared cache.  If the file isn't
+                # here, it's not anywhere.
+                raise POSException.POSKeyError("No blob file", oid, serial)
+
+        
         if os.path.exists(blob_filename):
-            if not self.shared_blob_dir:
+            try:
                 _accessed(blob_filename)
+            except OSError:
+                # It might have been deleted while we were calling _accessed.
+                # We don't have the file lock.
+                if os.path.exists(blob_filename):
+                    raise
             return blob_filename
 
-        if self.shared_blob_dir:
-            # We're using a server shared cache.  If the file isn't
-            # here, it's not anywhere.
-            raise POSException.POSKeyError("No blob file", oid, serial)
 
         # First, we'll create the directory for this oid, if it doesn't exist. 
         self.fshelper.createPathForOID(oid)

Modified: ZODB/branches/jim-zeo-blob-cache/src/ZEO/tests/testZEO.py
===================================================================
--- ZODB/branches/jim-zeo-blob-cache/src/ZEO/tests/testZEO.py	2008-12-02 23:21:49 UTC (rev 93562)
+++ ZODB/branches/jim-zeo-blob-cache/src/ZEO/tests/testZEO.py	2008-12-03 00:02:27 UTC (rev 93563)
@@ -737,7 +737,11 @@
         check_data(filename)
 
         # ... and on the server
-        server_filename = filename.replace(self.blob_cache_dir, self.blobdir)
+        server_filename = os.path.join(
+            self.blobdir,
+            ZODB.blob.BushyLayout().getBlobFilePath(oid, revid),
+            )
+        
         self.assert_(server_filename.startswith(self.blobdir))
         check_data(server_filename)
 

Modified: ZODB/branches/jim-zeo-blob-cache/src/ZODB/blob.py
===================================================================
--- ZODB/branches/jim-zeo-blob-cache/src/ZODB/blob.py	2008-12-02 23:21:49 UTC (rev 93562)
+++ ZODB/branches/jim-zeo-blob-cache/src/ZODB/blob.py	2008-12-03 00:02:27 UTC (rev 93563)
@@ -412,6 +412,8 @@
         """
         # TIDs are numbers and sometimes passed around as integers. For our
         # computations we rely on the 64-bit packed string representation
+        if isinstance(oid, int):
+            oid = utils.p64(oid)
         if isinstance(tid, int):
             tid = utils.p64(tid)
         return os.path.join(self.base_dir,



More information about the Zodb-checkins mailing list