[Checkins] SVN: relstorage/trunk/ When opening the database for the first time, don't issue a warning

Shane Hathaway shane at hathawaymix.org
Thu Aug 27 21:24:18 EDT 2009


Log message for revision 103326:
  When opening the database for the first time, don't issue a warning
  about the inevitable PosKeyError on the root OID.
  

Changed:
  U   relstorage/trunk/CHANGES.txt
  U   relstorage/trunk/relstorage/relstorage.py

-=-
Modified: relstorage/trunk/CHANGES.txt
===================================================================
--- relstorage/trunk/CHANGES.txt	2009-08-27 21:32:52 UTC (rev 103325)
+++ relstorage/trunk/CHANGES.txt	2009-08-28 01:24:18 UTC (rev 103326)
@@ -15,7 +15,10 @@
 - In Oracle, don't trip over transaction descriptions longer than 2000
   bytes.
 
+- When opening the database for the first time, don't issue a warning
+  about the inevitable PosKeyError on the root OID.
 
+
 Version 1.2.0b2 (2009-05-05)
 ----------------------------
 

Modified: relstorage/trunk/relstorage/relstorage.py
===================================================================
--- relstorage/trunk/relstorage/relstorage.py	2009-08-27 21:32:52 UTC (rev 103325)
+++ relstorage/trunk/relstorage/relstorage.py	2009-08-28 01:24:18 UTC (rev 103326)
@@ -308,6 +308,7 @@
         """
         cursor = self._load_cursor
         adapter = self._adapter
+        logfunc = log.warning
         msg = ["Storage KeyError on oid %d: %s" % (oid_int, reason)]
         rows = adapter.iter_transactions(cursor)
         row = None
@@ -315,6 +316,9 @@
             # just get the first row
             break
         if not row:
+            # This happens when initializing a new database, so it's
+            # not a warning.
+            logfunc = log.debug
             msg.append("No transactions exist")
         else:
             msg.append("Current transaction is %d" % row[0])
@@ -332,7 +336,7 @@
                 if len(tids) >= 10:
                     break
         msg.append("Recent object tids: %s" % repr(tids))
-        log.warning('; '.join(msg))
+        logfunc('; '.join(msg))
 
     def _get_oid_cache_key(self, oid_int):
         """Return the cache key for finding the current tid."""



More information about the checkins mailing list