[Zodb-checkins] SVN: ZODB/branches/jim-storage-api-cleanup/src/ZODB/FileStorage/FileStorage.py Fixed bugs in getTid:

Jim Fulton jim at zope.com
Wed Apr 25 19:26:33 EDT 2007


Log message for revision 74773:
  Fixed bugs in getTid:
  
  - The case of undo of creating transactions wasn't handled correctly.
  
  - Looked up values weren't cached. :(
  

Changed:
  U   ZODB/branches/jim-storage-api-cleanup/src/ZODB/FileStorage/FileStorage.py

-=-
Modified: ZODB/branches/jim-storage-api-cleanup/src/ZODB/FileStorage/FileStorage.py
===================================================================
--- ZODB/branches/jim-storage-api-cleanup/src/ZODB/FileStorage/FileStorage.py	2007-04-25 23:26:29 UTC (rev 74772)
+++ ZODB/branches/jim-storage-api-cleanup/src/ZODB/FileStorage/FileStorage.py	2007-04-25 23:26:32 UTC (rev 74773)
@@ -971,17 +971,17 @@
             result = self._get_cached_tid(oid)
             if result is None:
                 pos = self._lookup_pos(oid)
-                result = self._getTid(oid, pos)
+                h = self._read_data_header(pos, oid)
+                if h.plen == 0 and h.back == 0:
+                    # Undone creation
+                    raise POSKeyError(oid)
+                else:
+                    result = h.tid
+                    self._oid2tid[oid] = result
             return result
         finally:
             self._lock_release()
 
-    def _getTid(self, oid, pos):
-        self._file.seek(pos)
-        h = self._file.read(16)
-        assert oid == h[:8]
-        return h[8:]
-
     def _getVersion(self, oid, pos):
         h = self._read_data_header(pos, oid)
         if h.version:



More information about the Zodb-checkins mailing list