[Checkins] SVN: relstorage/branches/1.1-jarn/ Fix keyerror logging not to raise a keyerror itself. Note: we actually restart the load connection here so we can log some useful information. Ideally we would use transaction.doom(), but there's no support in zope2 for it yet. This should be safe as raising the keyerror will lead to a transaction failure anyway.

Laurence Rowe l at lrowe.co.uk
Sun Dec 21 12:04:30 EST 2008


Log message for revision 94216:
  Fix keyerror logging not to raise a keyerror itself. Note: we actually restart the load connection here so we can log some useful information. Ideally we would use transaction.doom(), but there's no support in zope2 for it yet. This should be safe as raising the keyerror will lead to a transaction failure anyway.

Changed:
  U   relstorage/branches/1.1-jarn/relstorage/relstorage.py
  U   relstorage/branches/1.1-jarn/setup.py

-=-
Modified: relstorage/branches/1.1-jarn/relstorage/relstorage.py
===================================================================
--- relstorage/branches/1.1-jarn/relstorage/relstorage.py	2008-12-21 05:58:07 UTC (rev 94215)
+++ relstorage/branches/1.1-jarn/relstorage/relstorage.py	2008-12-21 17:04:30 UTC (rev 94216)
@@ -242,6 +242,9 @@
         cursor = self._load_cursor
         adapter = self._adapter
         msg = ["Storage KeyError on oid %d: %s" % (oid_int, reason)]
+        msg.append("Last transaction is %s" % self.lastTransaction())
+        msg.append("Previously polled transaction is %s" 
+                   % self._prev_polled_tid)
         rows = adapter.iter_transactions(cursor)
         row = None
         for row in rows:
@@ -251,14 +254,32 @@
             msg.append("No transactions exist")
         else:
             msg.append("Current transaction is %d" % row[0])
-
-        rows = adapter.iter_object_history(cursor, oid_int)
-        tids = []
+        
+        # Collect data from newer transactions.
+        self._restart_load()
+        cursor = self._load_cursor
+        # it would be nice to transaction.doom() here
+        # but we can't really rely on that yet.
+        
+        rows = adapter.iter_transactions(cursor)
+        row = None
         for row in rows:
-            tids.append(row[0])
-            if len(tids) >= 10:
-                break
-        msg.append("Recent object tids: %s" % repr(tids))
+            # just get the first row
+            break
+        if row:
+            msg.append("Newest transaction is %d" % row[0])
+        
+        try:
+            rows = adapter.iter_object_history(cursor, oid_int)
+        except KeyError:
+            pass
+        else:
+            tids = []
+            for row in rows:
+                tids.append(row[0])
+                if len(tids) >= 10:
+                    break
+            msg.append("Recent object tids: %s" % repr(tids))
         log.warning('; '.join(msg))
 
     def load(self, oid, version):

Modified: relstorage/branches/1.1-jarn/setup.py
===================================================================
--- relstorage/branches/1.1-jarn/setup.py	2008-12-21 05:58:07 UTC (rev 94215)
+++ relstorage/branches/1.1-jarn/setup.py	2008-12-21 17:04:30 UTC (rev 94216)
@@ -27,7 +27,7 @@
 with RelStorage.
 """
 
-VERSION = "1.1jarn4"
+VERSION = "1.1jarn5"
 
 classifiers = """\
 Development Status :: 4 - Beta



More information about the Checkins mailing list